from math import floor doomsday_per_month_most = [3,28,0,4,9,6,11,8,5,10,14,12] doomsday_per_month_leap = [4,29,0,4,9,6,11,8,5,10,14,12] days_of_the_week = ["Sunday","Monday","Tuesday","Wednesday","Thursday",\ "Friday","Saturday"] def get_anchor_day_century(year): if(2000<=year<2100): return(2) elif(1900<=year<1999): return(3) print(f"The year {year} is not supported") def get_anchor_day_year(year): y = year %100 return(((floor(y/12) + y % 12 + floor(( y % 12 ) / 4))) % 7 +\ get_anchor_day_century( year ) ) def is_leap_year(year): return(year%4==0 and (year%100!=0 or year%400==0)) input1,input2,input3 = input().split() day = int(input1) month = int(input2) year = int(input3) doomsday_of_month = None if(is_leap_year(year)): doomsday_of_month = doomsday_per_month_leap[month-1] else: doomsday_of_month = doomsday_per_month_most[month-1] anchor = get_anchor_day_year(year) #print(days_of_the_week[anchor]) day_of_week = (day-doomsday_of_month+anchor)%7 print(days_of_the_week[day_of_week])