a = int(input()) c = input() if a <=1000: b = 8 else: t = (a-1000)//500+1 b = 8+4*t if c=='y': b = b+5 print(b)