P29241 [洛谷] [Chuanzhi Cup #3 Practice Contest] Julian Calendar
普及+
题目描述

Problem Description

Before 1582, a year that is a multiple of 4 is a leap year. Normally, the number of days in each month from January to December is 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 respectively. If it is a leap year, February has 29 days.

However, a certain Pope found that this method was not accurate enough and would cause errors. Therefore, starting from 1582, a year that is a multiple of 4, except those that are multiples of 100 but not multiples of 400, is a leap year. To eliminate the error, it was stipulated that the day after October 4, 1582, is October 15, 1582, and the intermediate dates are considered non-existent.

Given a date, calculate the number of days that have passed from January 1, 1 AD, to that date.

Input Format

Input data is given in the format daymonthyear, where day is an integer between 1 and 31, month is three uppercase letters, and year is an integer between 1 and 9999. The date is guaranteed to be valid and existent.

Uppercase letters for months:

  • 1月:JAN
  • 2月:FEB
  • 3月:MAR
  • 4月:APR
  • 5月:MAY
  • 6月:JUN
  • 7月:JUL
  • 8月:AUG
  • 9月:SEP
  • 10月:OCT
  • 11月:NOV
  • 12月:DEC

Output Format

Output an integer representing the answer.

Sample Input and Output

Sample Input #1

1JAN1

Sample Output #1

0

Sample Input #2

4OCT1582

Sample Output #2

577736

Sample Input #3

15OCT1582

Sample Output #3

577737

Sample Input #4

21NOV2020

Sample Output #4

737751
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1JAN1
样例输出
0