import sys

a=str(eval(input()))

if a=="SUN":

    print((7))

elif a=="MON":

    print((6))     

elif a=="TUE":

    print((5))

elif a=="WED":

    print((4))

elif a=="THU":

    print((3))

elif a=="FRI":

    print((2))

else :

    print((1))

    

a=str(eval(input()))

L=[" ","SAT","FRI","THU","WED","TUE","MON","SUN"]

for i in range(8):

    if a==L[i]:

        print(i)
import sys

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

a = str(eval(input()))
L = [" ", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"]
for i in range(8):
    if a == L[i]:
        print(i)

-import sys - -if a == "SUN": -    print((7)) -elif a == "MON": -    print((6)) -elif a == "TUE": -    print((5)) -elif a == "WED": -    print((4)) -elif a == "THU": -    print((3)) -elif a == "FRI": -    print((2)) -else: -    print((1)) +L = [" ", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"] +for i in range(8): +    if a == L[i]: +        print(i)