import sys
month = [31,28,31,30,31,30,31,31,30,31,30,31]
while True:
try:
y,m,d = map(int,((input().split())))
total = sum(month[:m-1]) + d
if ((y%4 == 0 and y%100 != 0) or (y%400 == 0)) and m > 2:
total += 1
print(total)
except:
break

京公网安备 11010502036488号