#include <iostream>
#include <map>
#include <vector>

using namespace std;
string s;
int tax;
map <string,int> m;
vector <vector<int> >v;

void pre()
{
    m["Single"]=1;
    m["Married joint filer"]=2;
    m["Surviving spouse"]=3;
    m["Head of household"]=4;
    m["Married filing separately"]=5;
    int a[]={0,9075,36900, 89350, 186350, 405100, 406750};
    int b[]={0,18150, 73800, 148850, 226850, 405100, 457600};
    int c[]={0,18150, 73800, 148850, 226850, 405100, 457600};
    int d[]={0,12950, 49400, 127550, 206600, 405100, 432200};
    int e[]={0,9075,36900, 74425, 113425, 202550, 228800};
    int cc[]={100, 150, 250, 280, 330, 350, 396};
    int i;

    if(m[s]==1){
    for(i=6;tax<a[i];i--);
        cout<<tax*cc[i]/1000;
    }
    if(m[s]==2 || m[s]==3){
    for(i=6;tax<b[i];i--);
        cout<<tax*cc[i]/1000;
    }
    else
    if(m[s]==4){
    for(i=6;tax<d[i];i--);
        cout<<tax*cc[i]/1000;
    }
    else
    if(m[s]==5){
    for(i=6;tax<e[i];i--);

        cout<<tax*cc[i]/1000;
    }

}

int main()
{
    char p[50];
cin.getline(p, 100);
s=p;

cin>>tax;
pre();
    return 0;
}