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

~/algor $ cat problems/case-keyingi-sana-kabisa

Tomorrow's date

Medium 1000 ms 64 MB 45%
Share

A date is given by three numbers: day $d$, month $m$ and year $y$. Find tomorrow's date. 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$. January 1 of the next year comes after December 31.

Moving past the end of February to the next day in a leap year

Input

One line with three integers: $d$, $m$ and $y$.

Output

One line with three integers: tomorrow's day, month and year.

Note

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

Examples

Input #1
28 2 2024
Output #1
29 2 2024
Input #2
28 2 2023
Output #2
1 3 2023

Sign in to submit a solution

Signing up is free and takes a minute.