#include <iostream>
#include <string>

using namespace std;

const int INF= (1<<30);

string s;
double tax[8]={0, 10, 15, 25, 28, 33, 35, 39.6};
int U[10][10];
int D[10][10];

void init() {
    U[1][1]= 9075;
    U[1][2]= 36900;
    U[1][3]= 89350;
    U[1][4]= 186350;
    U[1][5]= 405100;
    U[1][6]= 406750;
    U[1][7]= INF;

    U[2][1]= 18150;
    U[2][2]= 73800;
    U[2][3]= 148850;
    U[2][4]= 226850;
    U[2][5]= 405100;
    U[2][6]= 457600;
    U[2][7]= INF;

    U[3][1]= 12950;
    U[3][2]= 49400;
    U[3][3]= 127550;
    U[3][4]= 206600;
    U[3][5]= 405100;
    U[3][6]= 432200;
    U[3][7]= INF;

    U[4][1]= 9075;
    U[4][2]= 36900;
    U[4][3]= 74425;
    U[4][4]= 113425;
    U[4][5]= 202550;
    U[4][6]= 228800;
    U[4][7]= INF;
}

int main()
{
    init();

    int pers;
    getline(cin, s );

    if( s[1] == 'i' ) {
        pers= 1;
    }
    else if( s[1] == 'u' ) {
        pers= 2;
    }
    else if( s[1] == 'e' ) {
        pers= 3;
    }
    else if( s[0] == 'M' ) {
        if( s[8] == 'j' ) pers= 2;
        else pers= 4;
    }

    double money;
    int R;
    cin >> money;
    int r= 1;
    while( money > U[pers][r] ) ++r;

    R= (int)(money*tax[r]/100);

    cout << R;

    return 0;
}