#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int l; string s; cin >> l >> s; if (s == "Beat") ++l; vector x = { 390, 429, 468, 507, 546 }; cout << x[l - 1] << '\n'; return 0; }