Олимпиадный тренинг

Задача 27040. flight time


Задача

Темы:
When  semi-max  on  airplanes  in  quality  time  departure  and  arrival  used  local  time of departure and arrival airports.
Time zones are characterized by the difference in time with the meridian on which the Greenwich Observatory is located. For each time zone, a deviation from UTC (Coordinated Universal Time) is entered.
For example, Moscow is in the UTC+3 time zone, and Novosibirsk is in the UTC+7 time zone.  If  fly out  from  Moscow  flight  in  11:15  and  time  flight  exactly  in  4  hours,  then  arrival in Novosibirsk will be at 19:15 (4 hours of flight and 4 hours of time difference).
For example, Moscow is located in the UTC + 3 time zone, and Novosibirsk & nbsp; in UTC+7 time zone. If you leave Moscow on a flight at 11:15 and the flight time is exactly 4 hours, then your arrival in Novosibirsk will be at 19:15 (4 hours of flight and 4 hours of time difference).
Time zones can vary from UTC-11 (American Samoa) to UTC+14 (Line Islands, Kiribati).
Based on the given departure time and flight time, as well as the time zones of the departure and arrival airports, you need to determine the local arrival time and the number of days that have passed in
path.

Input data format
The first line contains integers H, MD (0 <= HD <=  23, 0 <= MD <= 59)  departure time.
The second line contains integers HF , MF (0 <= HF <= 109< /sup>, 0 <= MF <= 59)  flight time.
The third line contains integers D, A (-11 6 D, A <= 14)  time zones of the airport of departure and arrival.
 
Output format
Print three numbers HA;MA; Days  arrival time in hours and minutes, as well as the difference in dates between the date of departure and the date of arrival.

Rating system
Solutions that work correctly for flights whose departure and arrival dates are the same will score at least half of the points.
Enter Output
11 15
40
37
19 15 0
120
10
-10 13
12 0 1

Note
The first test corresponds to the example with Moscow and Novosibirsk analyzed in the condition.
The second test corresponds to, for example, an hour-long flight from American Samoa to Samoa.
The plane takes off at 12:00, flies for an hour and lands at 12:00 local time. Because he crossed the international date line, it is already the next day in Samoa.
In reality, there are time zones that differ from UTC by a non-integer number of hours, but they are not considered in the problem.