You are the sports minister of the student union, responsible for organizing the annual school basketball tournament. With the finals approaching, you want to attract more spectators, so you plan to upgrade your equipment by using a giant LED screen to display the scores. Of course, electricity is not free, so you decide to analyze past games to estimate the power consumption.
As shown in the figure above, each digit is composed of 7 segments, and each lit segment consumes 1 unit of electricity per second. Segments do not consume electricity when they are not lit. To save power, the score does not display leading zeros (however, the digit 0 must be displayed when the score is 0).
Your LED screen contains a total of 6 digits, meaning each team's score has up to 3 digits.
Input
The input contains no more than 100 test cases. The first line of each test case is "START hh:mm:ss", indicating the start time of the game as hh:mm:ss. The last line is "END hh:mm:ss", indicating the end time of the game. Between these two, there will be at least one SCORE message in the format "SCORE hh:mm:ss team score", where team is either "home" or "guest", and score is the points scored, which is 1, 2, or 3. These messages are guaranteed to be in chronological order, and no two SCORE messages occur at the same time. The game start time will not be earlier than 09:00:00, and the end time will not be later than 21:00:00 on the same day. Note that if the game starts at 09:00:00 and ends at 09:00:01, the game duration is 1 second, not 2 seconds.
Output
For each test case, output the test case number and the total power consumption.
Examples
Input 1
START 09:00:00 SCORE 09:01:05 home 2 SCORE 09:10:07 guest 3 END 09:15:00
Output 1
Case 1: 9672
Input 2
START 09:00:00 SCORE 10:00:00 home 1 SCORE 11:00:00 home 1 SCORE 12:00:00 home 1 SCORE 13:00:00 home 1 SCORE 14:00:00 home 1 SCORE 15:00:00 home 1 SCORE 16:00:00 home 1 SCORE 17:00:00 home 1 SCORE 18:00:00 home 1 SCORE 19:00:00 home 1 SCORE 20:00:00 home 1 END 21:00:00
Output 2
Case 2: 478800