#include <cassert>

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    string type;
    getline(cin, type);
    int income;
    cin >> income;
    vector<int> bounds = {0, 0, 0, 0, 0, 0}, rates = {100, 150, 250, 280, 330, 350, 396};
    if (type == "Single") {
        bounds = {9075, 36900, 89350, 186350, 405100, 406750};
    } else if (type == "Married joint filer" || type == "Surviving spouse") {
        bounds = {18150, 73800, 148850, 226850, 405100, 457600};
    } else if (type == "Head of household") {
        bounds = {12950, 49400, 127550, 206600, 405100, 432200};
    } else if (type == "Married filing separately") {
        bounds = {9075, 36900, 74425, 113425, 202550, 228800};
    } else {
        assert(false);
    }
    int i = 0;
    for (; i < 6 && income > bounds[i]; ++i);
    cout << (income * rates[i]) / 1000 << "\n";
    return 0;
}