P8831 [Chuanzhi Cup #3 Practice Contest] Julian Calendar
Description
Before 1582, any year that is a multiple of $4$ is a leap year. Normally, the numbers of days in January to December are $31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31$. If the year is a leap year, then February has $29$ days.
However, a pope found that this rule was not accurate enough and would cause errors. Therefore, starting from 1582, a year that is a multiple of $4$ is a leap year unless it is a multiple of $100$ but not a multiple of $400$. At the same time, to remove the error, it was规定 that the day after October $4$, 1582 is October $15$, 1582, and the dates in between are considered not to exist.

Now you are given a date. Compute how many days have passed from this date to January $1$, year $1$ AD.
Input Format
Input the data in the format `day month year`, where day is an integer between $1$ and $31$, month is three uppercase letters, and year is an integer between $1$ and $9999$. It is guaranteed that the date is valid and exists.
The uppercase letters for months:
- January: JAN
- February: FEB
- March: MAR
- April: APR
- May: MAY
- June: JUN
- July: JUL
- August: AUG
- September: SEP
- October: OCT
- November: NOV
- December: DEC
Output Format
Output an integer representing the answer.
Explanation/Hint
Translated by ChatGPT 5