John is going back home after a party. Currently he is standing on a bus station and waiting for a bus to arrive. There is a timetable of arriving buses near the station. Beside this, John also knows the amount of time that is needed to travel with specific bus. As he has only one ticket, there are no possibilities to change the bus somewhere in the middle of a trip in order to make it shorter. Can you help John to calculate minimal time that he needs to get home? Input There is a number of tests T (T ≤ 100) on the first line. Each test case contains the number of buses K (1 ≤ K ≤ 100) and current time (in format ‘HH:MM’. Each of the next K lines contain arrival time of the bus (in the same format as current time) and travelling time 0 ≤ Q ≤ 1000 needed for John to get home (in minutes). Refer to the sample input as an example. Output For each test case output a single line ‘Case T: N’. Where T is the test case number (starting from 1) and N minimal time (in minutes) needed for John to go back home. Sample Input 2 1 18:00 19:30 30 2 18:00 19:00 100 20:00 30 Sample Output Case 1: 120 Case 2: 150