Woburn Challenge 2002
The cows have been advancing steadily against a weak monkeys' front. The Head-Monkey, employing logic not used since the debacle of the Polish Un-Truth Table, decides to expose the monkeys' backs, hoping for better luck. Unfortunately, this tactic is not successful, and the monkeys are forced to retreat further into the deep recesses of Scarberia, with sore bottoms, no less.
The Head-Monkey decides it's time for action. But before anything can be
done, a meeting must be called to decide what must be done. And in
this meeting, several debates must be fought, each lasting several
hours, and each leading to the inevitable conclusion, "Just leave it as
it was last year!" The Head-Monkey sends forth word to her disciples to
meet at the top of the Enchanted Tree at the next time when the
digits of the time sum to a certain number,
Input Specification
The first line of input contains a single integer
The second line contains a single integer,
Output Specification
A single integer that is the number of minutes left before a meeting
occurs or Infinite
if a meeting never occurs. Note that the output
will never be
Sample Input
3
11:59
3
01:00
15
12:11
33
Sample Output
1
59
Infinite
Comments