Stars
In Flower City, there lived a renowned astronomer named Skelko. He possessed the unique ability to craft magnifying glasses from shards of broken bottles and had built a telescope for himself. Skelko had a strict routine: every night, starting at 8:00 PM, he would observe the stars for at least 2 hours and 43 minutes. However, he often succumbed to sleep, necessitating multiple observation sessions. On this particular night, he had already ventured out N times and recorded the intervals of his observations. Upon waking up for the last time, he resolved to complete his observation quota. Write a program to determine when he can finally return to bed. If he has already observed for the required duration, he can go to bed immediately. All times are provided in the format hh:mm (0 ≤ hh ≤ 23, 0 ≤ mm ≤ 59), which must be strictly adhered to, and fall within the range from 8:00 PM to 6:00 AM the following day.
Input Data
The program receives the number of previous observations 0 ≤ N ≤ 8. Following this, N lines contain the start and end times of these observations, separated by a space. The final line provides the time of Skelko's last awakening.
Output Data
The program should output the time Skelko can return to bed in the specified format.
Comments
Test1. Skelko has already observed for 2 hours and 30 minutes, leaving 13 minutes of observation remaining.
Test2. The observation requirement has already been fulfilled, so he can go to sleep immediately.