#include <iostream>
#include <fstream>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <queue>

#define LL long long
#define pb push_back
#define lm 10001
#define MOD 1000000007

using namespace std;

int s[6]={9075,36900,89350,186350,405100,406750};
int m[6]={18150,73800,148850,226850,405100,457600};
int h[6]={12950,49400,127550,206600,405100,432200};
int f[6]={9075,36900,74425,113425,202550,228800};
double tax[7]={10,15,25,28,33,35,39.6};

string st;
long int n;
bool ok=false;
int main()
{
    //freopen("data.in","r",stdin);

    cin>>st;
    cin>>n;
    if(st=="Single")
    {
        for(int i=0; i<6; i++)
        {
            if(n<=s[i])
            {
                ok=true;
                cout<<int((n*tax[i])/100);
                break;
            }
        }
        if(!ok)
        {
           cout<<int((n*tax[6])/100);
        }
    }
    else if(st=="Married joint filer")
    {
        for(int i=0; i<6; i++)
        {
            if(n<=m[i])
            {
                ok=true;
                cout<<int((n*tax[i])/100);
                break;
            }
        }
        if(!ok)
        {
           cout<<int((n*tax[6])/100);
        }
    }
    else if(st=="Surviving spouse")
    {
        for(int i=0; i<6; i++)
        {
            if(n<=m[i])
            {
                ok=true;
                cout<<int((n*tax[i])/100);
                break;
            }
        }
        if(!ok)
        {
           cout<<int((n*tax[6])/100);
        }
    }
    else if(st=="Head of household")
    {
        for(int i=0; i<6; i++)
        {
            if(n<=h[i])
            {
                ok=true;
                cout<<int((n*tax[i])/100);
                break;
            }
        }
        if(!ok)
        {
           cout<<int((n*tax[6])/100);
        }
    }
    else if(st=="Married filing separately")
    {
        for(int i=0; i<6; i++)
        {
            if(n<=f[i])
            {
                ok=true;
                cout<<int((n*tax[i])/100);
                break;
            }
        }
        if(!ok)
        {
           cout<<int((n*tax[6])/100);
        }
    }

    return 0;
}