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))

elif S == 'SAT': print((1)) 
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)) 
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))
elif S == "SAT":
    print((1))

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))

-elif S == "SAT": +else: