#include <fstream>
#include <iostream>
#include <string>
#include <map>
#include <cmath>
#include <algorithm>
#include <vector>
#include <list>
#include <set>
#include <cstring>
#include <climits>
#include <deque>
#include <stack>

using namespace std;

#define ONLINE_JUDGE1

string S;

double tax[] = { 10, 15, 25, 28, 33, 35, 39.6 };
int V1[] = { 9075, 36900, 89350, 186350, 405100, 406750 };
int V2[] = { 18150, 73800, 148850, 226850, 405100, 457600 };
int V3[] = { 12950, 49400, 127550, 206600, 405100, 432200 };
int V4[] = { 9075, 36900, 74425, 113425, 2024550, 228800 };

void func(int x, int V[]) {
	int i;
	i = 0;
	while (i < 6 && x > V1[i]) {
		++i;
	}
	cout << (int)(((double)x * tax[i]) / 100);
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
#endif
	int i, x;
	getline(cin, S);
	cin >> x;
	if (S.compare("Single") == 0) {
		func(x, V1);
	}
	else if (S.compare("Married joint filer") == 0 || S.compare("Surviving spouse") == 0) {
		func(x, V2);
	}
	else if (S.compare("Head of household") == 0) {
		func(x, V3);
	}
	else if (S.compare("Married filing separately") == 0) {
		func(x, V4);
	}
	
#ifndef ONLINE_JUDGE
	while (1);
#endif
	return 0;
}