python
闰年2月多一天,29天。闰年比平年多一天366天。
闰年判断条件 :
(1)是4的倍数但不是100的倍数
(2)是400的倍数

while True:
    try:
        year,mon,date = map(int,input().split())
        if mon <1 or mon >12 or date <1 or date >31:
            continue

        mon_list = [31,28,31,30,31,30,31,31,30,31,30,31]

        num = 0
        for m in range(mon-1):
            num += mon_list[m]
        num += date
        run_flag = 0
        if year % 4 == 0 and year %100 != 0 or year % 400 == 0: 
            run_flag = 1
        if run_flag and mon>2:
            num += 1
        print(num)
    except :
        break