Under construction

Still being built. Things may change

Brsil Comet

Time limit1sMemory limit1024 MB

Summary
Given a date on a 360-day calendar and a period N, the task is to find the next date after today that is a multiple of N days later.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Brsil, an idol from Brsil Cup, appeared like a comet, and people from all over the country gathered at the observatory to see her. The nickname "appeared like a comet" comes from the fact that Brsil can be observed periodically, like a comet. Given that Brsil can be seen today, find the earliest date on which Brsil can be seen again.

For convenience, assume that a month has 3030 days and a year has 1212 months (that is, a year has 360360 days).

Input

The first line contains today's date in the form yyyy-mm-dd. 1 000≤1\,000 \le yyyy ≤3 000\le 3\,000; 1≤1 \le mm ≤12\le 12; 1≤1 \le dd ≤30\le 30.

The second line contains an integer NN. This means Brsil can be observed every NN days. 1≤N≤1 000 0001 \le N \le 1\,000\,000.

Output

Print the earliest date after today on which Brsil can be seen, in the form yyyy-mm-dd.

Examples1

  1. Example 1

    Input
    2023-07-08
    30
    
    Expected output
    2023-08-08