#include <iostream>
#include <fstream>
#include <cstring>
#include <iomanip>
using namespace std;

#define F cin
#define G cout

//ifstream F("p.in");
//ofstream G("p.out");

string s;

int t[] = {9075,18150,12950,9075,
36900,73800,49400,36900,
89350,148850,127550,74425,
186350,226850,206600,113425,
405100,405100,405100,202550,
406750,457600,432200,228800 ,0 };

double p[] = { 10 , 15 , 25 , 28 , 33 , 35 , 39.6 , 0 };

int x,money;

char c[110];

int main()
{
    F.getline(c,100,'\n');
    s = c;
    if ( s == "Single" ) x = 1;
    if ( s == "Married joint filer" ) x = 2;
    if ( s == "Surviving spouse" ) x = 2;
    if ( s == "Head of household" ) x = 3;
    if ( s == "Married filing separately" ) x = 0;
    F>>money;
    int r = 0;
    for (int i=0,f=0,j=1;t[i] != 0;++i)
    {
        if ( j == x )
        {
            if ( money < t[i] )
            {
                double per = p[r] / 100.0;
                per *= money;
                int out = per;
                G<<out<<'\n';
                return 0;
            }
        }
        if ( (++j) == 4 )
        {
            j = 0;
        }
        if ( j == 1 )
        {
            ++r;
            f = 1;
        }
    }
    double per = p[r] / 100.0;
    per *= money;
    int out = per;
    G<<out<<'\n';
}