시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 95 52 47 62.667%

문제

우리는 일상생활에서 휴가 일수를 계산하는 것 처럼 두 날짜 사이의 기간을 계산해야 하는 경우가 많다.

이때, 계산을 하는 가장 간단한 방법은 적당한 날짜를 잡은 뒤 계산할 날짜가 될 때까지 하루가 지날 때마다 계속 카운트를 하는 것이다.

이 문제에서는 해당하는 연도의 1월 1일을 시작하는 기준으로 잡을 것이다.

예를 들어 2005년 8월 13일은 총 225일이다. 그리고 그 1년 전인 2004년 8월 13일은 총 226일인데, 2004년은 윤년이기 때문이다.

윤년은 해당하는 연도가 4로 나누어 떨어지며 100으로는 나누어지는 연도는 제외하며, 그 중에서도 400으로 나누어 떨어지는 연도는 다시 포함한다. 그러므로 2000년이나 1976년은 윤년이다. 그러나, 1900년이나 1977년과 같은 경우는 윤년이 아니다.

또한 여러분은 28일로 이루어진(윤년에는 29일) 2월, 30일로 이루어진 4월, 6월 , 9월, 11월을 제외한 모든 달은 31일로 이루어져 있다는 것을 알고 있다.

이 문제에서, 여러분은 주어진 날짜를 카운트해야 한다.

입력

입력은 한 줄의 날짜로 이루어진다.

각 날짜는 일, 월, 년이 공백을 두고 주어지며, 일과 월은 항상 유효하며, 연도는 항상 1800과 2200사이의 값으로만 주어진다.

0 0 0이 입력되면 프로그램을 종료한다.

출력

각 줄에 날짜에 해당하는 날의 수를 출력한다.

예제 입력 1

14 8 2004
1 1 2004 
31 1 1976
1 3 1974
1 3 1976
0 0 0

예제 출력 1

227
1
31
60
61
W3sicHJvYmxlbV9pZCI6IjIxMzkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWIwOThcdWIyOTQgXHViMTA4XHVhYzAwIFx1YzBiNFx1YzU0NFx1YzYyOCBcdWIwYTBcdWM3NDQgXHVjNTRjXHVhY2UwIFx1Yzc4OFx1YjJlNCIsImRlc2NyaXB0aW9uIjoiPHA+XHVjNmIwXHViOWFjXHViMjk0IFx1Yzc3Y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