#include [[nodiscard]] static inline constexpr const char* solve(const uint_fast32_t L, const std::string& S) noexcept { static constexpr const char* rate[] = { "dummy", "390", "429", "468", "507", "546" }; return rate[L + (S == "Beat")]; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); uint_fast32_t L; std::string S; S.reserve(6); std::cin >> L >> S; std::cout << solve(L, S) << '\n'; return 0; }