//Code by Patcas Csaba

#include <vector>
#include <string> 
#include <set> 
#include <map> 
#include <queue> 
#include <bitset> 
#include <stack>
#include <list>

#include <numeric> 
#include <algorithm> 

#include <cstdio>
#include <fstream>
#include <iostream> 
#include <sstream> 
#include <iomanip>

#include <cctype>
#include <cmath> 
#include <ctime>
#include <cassert>

using namespace std;

#define LL long long
#define PII pair <int, int>
#define VB vector <bool>
#define VI vector <int>
#define VD vector <double>
#define VS vector <string>
#define VPII vector <pair <int, int> >
#define VVI vector < VI >
#define VVB vector < VB >

#define FORN(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REPEAT do{ 
#define UNTIL(x) }while(!(x)); 

#define SZ size()
#define BG begin() 
#define EN end() 
#define CL clear()
#define X first
#define Y second
#define RS resize
#define PB push_back
#define MP make_pair
#define ALL(x) x.begin(), x.end()

#define IN_FILE "a.in"
#define OUT_FILE "a.out"

FILE *stream1, *stream2;
string s;
int x;
double tax[7] = {10, 15, 25, 28, 33, 35, 39.6};
int limit[4][7] = {
{0, 9075, 36900, 89350, 186350, 405100, 406750},
{0, 18150, 73800, 148850, 226850, 405100, 457600},
{0, 12950, 49400, 127550, 206600, 405100, 432200},
{0, 9075, 36900, 74425, 113425, 202550, 228800}
};

int main()
{
	//Read data
	//freopen_s(&stream1, IN_FILE, "r", stdin);
	//freopen_s(&stream2, OUT_FILE, "w", stdout);
	
	//Solve
  getline(cin, s);
  cin >> x;
  int ind;
  if (s == "Single") ind = 0;
  if (s == "Married joint filer") ind = 1;
  if (s == "Surviving spouse") ind = 1;
  if (s == "Head of household") ind = 2;
  if (s == "Married filing separately") ind = 3;

  int cat = 6;
  if (limit[ind][6] > x)
   FORD(i, 5, 0)
    if (x > limit[ind][i])
    {
      cat = i;
      break;
    }
	//Write data
  int ans = x * (tax[cat] / 100.0);
  cout << ans;

	return 0;
}