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

~/algor $ cat problems/case-yilning-kuni

Day of the year

Easy 1000 ms 64 MB 26%
Share

A date of a non-leap year is given: day $d$ and month $m$. Determine which day of the year it is: January 1 is day $1$, December 31 is day $365$. Months $1, 3, 5, 7, 8, 10, 12$ have $31$ days, months $4, 6, 9, 11$ have $30$ days, and February has $28$ days.

The sequence of days passed since the start of the year

Input

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

Output

One integer — the number of the day in the year.

Note

$1 \le m \le 12$
$1 \le d \le 31$
The date is guaranteed to be valid.

Examples

Input #1
3 2
Output #1
34
Input #2
31 12
Output #2
365

Sign in to submit a solution

Signing up is free and takes a minute.