#include #include using namespace std; using ll = long long; int main() { int l;string s; cin >> l >> s; if (s == "Beat") l++; if (l >= 6) { return 0; } if (l == 1) { cout << 390 << endl; } else if (l == 2) { cout << 429 << endl; } else if (l == 3) { cout << 468 << endl; } else if (l == 4) { cout << 507 << endl; } else { cout << 546 << endl; } }