#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); vector A = {390,429,468,507,546}; int L; string s; cin >> L >> s; if(s == "Beat") L++; cout << A.at(L-1) << endl; }