시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 84 43 38 59.375%

문제

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

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

이 문제에서는 해당하는 연도의 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+XHVjNmIwXHViOWFjXHViMjk0IFx1Y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