Integer
Integer-41
Integer-42
Integer-43
~/algor $ cat problems/integer-dars-tugash-vaqti
Lesson end time
Medium
1000 ms
64 MB
38%
Lessons start at $h$ hours $m$ minutes. Each lesson lasts $a$ minutes, and there is a $b$-minute break between two consecutive lessons. Find the hour and the minute when lesson $k$ ends. For example, if lessons start at $8{:}00$, $a = 45$ and $b = 5$, lesson $2$ ends at $9{:}35$.
Input
One line with five integers: $h$, $m$, $a$, $b$ and $k$.
Output
One line with two integers: hours and minutes.
Note
$0 \le h \le 23$
$0 \le m \le 59$
$1 \le a \le 120$
$0 \le b \le 60$
$1 \le k \le 10$
Lesson $k$ ends on the same day, no later than $23{:}59$.
Examples
Input #1
8 0 45 5 2
Output #1
9 35
Input #2
13 30 40 10 1
Output #2
14 10