ls=['SUN','MON','TUE','WED','THU','FRI','SAT']

x=eval(input())

for i in range(7):

  if x==ls[i]:

    print((7-i))

    break

S=eval(input())

if S=='SUN':

  print((7))

elif S=='MON':

  print((6))

elif S=='TUE':

  print((5))

elif S=='WED':

  print((4))

elif S=='THU':

  print((3))

elif S=='FRI':

  print((2))

else:

  print((1))
ls = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
x = eval(input())
for i in range(7):
    if x == ls[i]:
        print((7 - i))
        break

S = eval(input())
if S == "SUN":
    print((7))
elif S == "MON":
    print((6))
elif S == "TUE":
    print((5))
elif S == "WED":
    print((4))
elif S == "THU":
    print((3))
elif S == "FRI":
    print((2))
else:
    print((1))

-ls = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"] -x = eval(input()) -for i in range(7): -    if x == ls[i]: -        print((7 - i)) -        break +S = eval(input()) +if S == "SUN": +    print((7)) +elif S == "MON": +    print((6)) +elif S == "TUE": +    print((5)) +elif S == "WED": +    print((4)) +elif S == "THU": +    print((3)) +elif S == "FRI": +    print((2)) +else: +    print((1))