#CCBCMCHIN0000061. Số ngày của tháng (Number of Days in a Month)

Số ngày của tháng (Number of Days in a Month)

Number of Days in a Month

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given integer month m and year y in the Gregorian calendar, print the number of days in that month, or -1 if the month is outside 1..12.

Input

One line contains two integers m and y.

Output

Print the number of days, or -1 for an invalid month.

Subtasks

  • Subtask 1 (20 points): m is a 31-day month, 1 <= y <= 9999.

  • Subtask 2 (30 points): m is a valid non-February month, 1 <= y <= 9999.

  • Subtask 3 (50 points): -12 <= m <= 24 and 1 <= y <= 9999.

Examples

Example 1

Input

2 1900

Output

28

Explanation

For this input, the case-specific computation and the required exact output are shown above. 1900 is a century year not divisible by 400, so February has 28 days.

Example 2

Input

2 2000

Output

29

Explanation

For this input, the case-specific computation and the required exact output are shown above. 2000 is divisible by 400, so February has 29 days.

Example 3

Input

13 2024

Output

-1

Explanation

For this input, the case-specific computation and the required exact output are shown above. 13 is not a valid month, so output -1.