#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;


int tabel[6][5] = {
    10, 9075, 18150, 12950,9075,
    15, 36900, 73800, 49400, 36900,
    25, 89350, 148850, 127550, 74225,
    28, 186350, 226850, 206600, 113425,
    33, 405100, 405100, 405100, 202550,
    35, 406750, 457600, 432200, 228800};

vector <string> maps;

int p[5] = {1,2,2,3,4};

int main(){

    //freopen("fis.in", "r", stdin);

    string s;
    int val;

    maps.push_back("Single");
    maps.push_back("Marriedjointfilers");
    maps.push_back("Survivingspouses");
    maps.push_back("Headsofhousehold");
    maps.push_back("Marriedfilingseparately");


    char c;
    do{ 
        string p;
        cin >> p;
        scanf("%c", &c);

        s = s + p;
        
    } while(c!='\n');

    cin >> val;

    int col = p[find(maps.begin(), maps.end(), s) - maps.begin()];
    
    int res = -1;
    for(int i = 0; i <= 5; ++i){
        if(val <= tabel[i][col]){
            res = i;
            break;
        }
    }

    double tax = 39.6;

    if(res != -1){
        tax = tabel[res][0];
    }

    res= (int)(tax/100 * val);

    printf("%d\n", res);

    return 0;
}