Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/case-oy-kunlari-kabisa

Days of a month in a leap year

Easy 1000 ms 64 MB 25%
Share

A month number $m$ and a year $y$ are given. Find how many days this month has in this year. Months $1, 3, 5, 7, 8, 10, 12$ have $31$ days, months $4, 6, 9, 11$ have $30$ days. February has $29$ days in a leap year and $28$ in other years. A year is a leap year if it is divisible by $4$ and not by $100$, or if it is divisible by $400$.

The days on a calendar page for a month and year

Input

One line with two integers: $m$ and $y$.

Output

One integer — the number of days in the month.

Note

$1 \le m \le 12$
$1 \le y \le 9999$

Examples

Input #1
2 2024
Output #1
29
Input #2
2 1900
Output #2
28

Sign in to submit a solution

Signing up is free and takes a minute.