#include <iostream>
#include <cstdio>

using namespace std;

int main() {
  string type;
  getline( cin, type );
  int tax_income;
  cin >> tax_income;
  
  double tax_rate = 0;
  if ( type == "Single" ) {
    if ( tax_income <= 9075 ) {
      tax_rate = 10;
    } else if ( tax_income <= 36900 ) {
      tax_rate = 15;
    } else if ( tax_income <= 89350 ) {
      tax_rate = 25;
    } else if ( tax_income <= 186350 ) {
      tax_rate = 28;
    } else if ( tax_income <= 405100 ) {
      tax_rate = 33;
    } else if ( tax_income <= 406750 ) {
      tax_rate = 35;
    } else {
      tax_rate = 39.6;
    }
  } else if ( type == "Married joint filer" || type == "Surviving spouse" ) {
    if ( tax_income <= 18150 ) {
      tax_rate = 10;
    } else if ( tax_income <= 73800 ) {
      tax_rate = 15;
    } else if ( tax_income <= 148850 ) {
      tax_rate = 25;
    } else if ( tax_income <= 226850 ) {
      tax_rate = 28;
    } else if ( tax_income <= 405100 ) {
      tax_rate = 33;
    } else if ( tax_income <= 457600 ) {
      tax_rate = 35;
    } else {
      tax_rate = 39.6;
    }
  } else if ( type == "Head of household" ) {
    if ( tax_income <= 12950 ) {
      tax_rate = 10;
    } else if ( tax_income <= 49400 ) {
      tax_rate = 15;
    } else if ( tax_income <= 127550 ) {
      tax_rate = 25;
    } else if ( tax_income <= 206600 ) {
      tax_rate = 28;
    } else if ( tax_income <= 405100 ) {
      tax_rate = 33;
    } else if ( tax_income <= 432200 ) {
      tax_rate = 35;
    } else {
      tax_rate = 39.6;
    }
  } else if ( type == "Married filing separately" ) {
    if ( tax_income <= 9075 ) {
      tax_rate = 10;
    } else if ( tax_income <= 36900 ) {
      tax_rate = 15;
    } else if ( tax_income <= 74425 ) {
      tax_rate = 25;
    } else if ( tax_income <= 113425 ) {
      tax_rate = 28;
    } else if ( tax_income <= 202550 ) {
      tax_rate = 33;
    } else if ( tax_income <= 228800 ) {
      tax_rate = 35;
    } else {
      tax_rate = 39.6;
    }
  }

  double multiply = (double) tax_rate / 100;

  int ans = (int) tax_income * multiply;
  
  cout << ans;
}