#AtCoder Beginner 13 A
str = raw_input()
if str == "Sunday" or str == "Saturday":
    print "0"
elif str == "Monday":
    print "5"
elif str == "Tuesday":
    print "4"
elif str == "Wednesday":
    print "3"
elif str == "Thursday":
    print "2"
elif str == "Friday":
    print "1"

#AtCoder Beginner 13 A
str = raw_input()
if str == "Sunday" or str == "Saturday":
    print "0"
elif str == "Monday":
    print "5"
elif str == "Tuesday":
    print "4"
elif str == "Wednesday":
    print "3"
elif str == "Thursday":
    print "2"
elif str == "Friday":
    print "1"

#AtCoder Beginner 13 A