def ptyear(mm,dd):
year = {"1": "31", "2": "28", "3": "31", "4": "30", "5": "31", "6": "30", "7": "31", "8": "31", "9": "30","10": "31", "11": "30", "12": "31"}
for i in range(1, int(mm)):
dd = dd + int(year[str(i)])
print(dd)
def ryear(mm,dd):
year = {"1": "31", "2": "29", "3": "31", "4": "30", "5": "31", "6": "30", "7": "31", "8": "31", "9": "30","10": "31", "11": "30", "12": "31"}
for i in range(1, int(mm)):
dd = dd + int(year[str(i)])
print(dd)
while True:
try:
year = input()
list = year.split(" ")
if(int(list[0])%100 == 0):
if(int(list[0])%400 == 0):
ryear(int(list[1]),int(list[2]))
else:
ptyear(int(list[1]),int(list[2]))
elif(int(list[0])%4 == 0):
ryear(int(list[1]),int(list[2]))
else:
ptyear(int(list[1]),int(list[2]))
except:
break