import math
a,b = map(str,input().split())
a = float(a)
price = 20
if a > 1:
price = price + math.ceil(a)-1
if b == 'y':
price = price + 5
print(price)
a,b = map(str,input().split())
a = float(a)
price = 20
if a > 1:
price = price + math.ceil(a)-1
if b == 'y':
price = price + 5
print(price)