#include<iostream>
using namespace std;
int main()
{
int rank;
int so_gio=0, tham_nien=0, thai_do=0, luong=0;
int thuong_gio=0, thuong_tham_nien=0, thuong_thai_do=0;
luong = 0;
cin >> rank;
cin >> so_gio >> tham_nien >> thai_do;
if (rank == 1)
{
luong = 20000000;
}
else if (rank == 2)
{
luong = 15000000;
}
else if (rank == 3)
{
luong = 5000000;
}
if (rank == 1)
{
if (so_gio <= 160)
{
thuong_gio = 0;
}
else if (so_gio > 160)
{
thuong_gio = (so_gio - 160) * 200000;
}
}
if (rank == ((1) || rank == (2)))
{
if (tham_nien < 1)
{
thuong_tham_nien = 0;
}
else if ((tham_nien >= 1) && (tham_nien <= 5))
{
thuong_tham_nien = 2000000;
}
else if (tham_nien > 5)
{
thuong_tham_nien = 5000000;
}
}
else if (rank == 3)
{
thuong_tham_nien = 0;
}
if ((thai_do <= 100) && (thai_do >= 90))
{
thuong_thai_do = luong/100*10;
}
else if ((thai_do <= 89) && (thai_do >= 70))
{
thuong_thai_do = luong / 100 * 5;
}
else if (thai_do > 70)
{
thuong_thai_do = 0;
}
cout << luong + thuong_gio + thuong_thai_do + thuong_tham_nien;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCkKewppbnQgcmFuazsKaW50IHNvX2dpbz0wLCB0aGFtX25pZW49MCwgdGhhaV9kbz0wLCBsdW9uZz0wOwppbnQgdGh1b25nX2dpbz0wLCB0aHVvbmdfdGhhbV9uaWVuPTAsIHRodW9uZ190aGFpX2RvPTA7Cmx1b25nID0gMDsKCmNpbiA+PiByYW5rOwpjaW4gPj4gc29fZ2lvID4+IHRoYW1fbmllbiA+PiB0aGFpX2RvOwoKaWYgKHJhbmsgPT0gMSkKewogICAgbHVvbmcgPSAyMDAwMDAwMDsKfQplbHNlIGlmIChyYW5rID09IDIpCnsKICAgIGx1b25nID0gMTUwMDAwMDA7Cn0KZWxzZSBpZiAocmFuayA9PSAzKQp7CiAgICBsdW9uZyA9IDUwMDAwMDA7Cn0KCmlmIChyYW5rID09IDEpCnsKICAgIGlmIChzb19naW8gPD0gMTYwKQogICAgewogICAgICAgIHRodW9uZ19naW8gPSAwOwogICAgfQogICAgZWxzZSBpZiAoc29fZ2lvID4gMTYwKQogICAgewogICAgICAgIHRodW9uZ19naW8gPSAoc29fZ2lvIC0gMTYwKSAqIDIwMDAwMDsKICAgIH0KCn0KCgppZiAocmFuayA9PSAoKDEpIHx8IHJhbmsgPT0gKDIpKSkKewogICAgaWYgKHRoYW1fbmllbiA8IDEpCiAgICB7CiAgICAgICAgdGh1b25nX3RoYW1fbmllbiA9IDA7CiAgICB9CiAgICBlbHNlIGlmICgodGhhbV9uaWVuID49IDEpICYmICh0aGFtX25pZW4gPD0gNSkpCiAgICB7CiAgICAgICAgdGh1b25nX3RoYW1fbmllbiA9IDIwMDAwMDA7CiAgICB9CiAgICBlbHNlIGlmICh0aGFtX25pZW4gPiA1KQogICAgewogICAgICAgIHRodW9uZ190aGFtX25pZW4gPSA1MDAwMDAwOwogICAgfQp9CmVsc2UgaWYgKHJhbmsgPT0gMykKewogICAgdGh1b25nX3RoYW1fbmllbiA9IDA7Cn0KCmlmICgodGhhaV9kbyA8PSAxMDApICYmICh0aGFpX2RvID49IDkwKSkKewogICAgdGh1b25nX3RoYWlfZG8gPSBsdW9uZy8xMDAqMTA7Cn0KZWxzZSBpZiAoKHRoYWlfZG8gPD0gODkpICYmICh0aGFpX2RvID49IDcwKSkKewogICAgdGh1b25nX3RoYWlfZG8gPSBsdW9uZyAvIDEwMCAqIDU7Cn0KZWxzZSBpZiAodGhhaV9kbyA+IDcwKQp7CiAgICB0aHVvbmdfdGhhaV9kbyA9IDA7Cn0KY291dCA8PCBsdW9uZyArIHRodW9uZ19naW8gKyB0aHVvbmdfdGhhaV9kbyArIHRodW9uZ190aGFtX25pZW47CgpyZXR1cm4gMDsKfQo=