Zayo Bayo
Time limit1sMemory limit1024 MB
Given x cabbages, a travel time of n days per trip, and a start date, find the date when the last cabbage reaches home.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation, Math, Brute force
- Solved
- No attempts yet
Problem
Zayo Bayo must carry x cabbages to his hut. The cabbages are far from his home. He can carry only one cabbage at a time. Zayo travels from the place where the cabbages are to his home in n days. He is at the cabbages and starts carrying them on a given date, and he does not stop until he has carried all the cabbages.
Write a program rabbit that determines the date on which Zayo Bayo finishes carrying the cabbages.
Input
The first line of the standard input contains two integers x and n: the number of cabbages Zayo must carry and the number of days he travels from the place where the cabbages are to his home.
The second line of the standard input contains three integers d, m and g: the day, month and year when Zayo starts carrying the cabbages.
Output
On one line of the standard output, the program must print three integers separated by one space: the day, month and year when Zayo finishes carrying the cabbages.
Constraints
- 1 ≤ d ≤ 31
- 1 ≤ m ≤ 12
- 1900 ≤ g ≤ 2100
- 2 ≤ x ≤ 5
- 1 ≤ n ≤ 3