### Problem Statement

According to Lewis Carroll, a clock that has stopped is more accurate than one that is five minutes behind. He argues that the former is right twice a day, whereas the latter never shows the correct time. Then again, a clock that is always five minutes behind is in a sense perfectly accurate, and therefore an extraordinary specimen. More usually, a clock is ahead or behind because it runs at the wrong rate, so that its absolute discrepancy from the true time is steadily changing. If left unregulated, such a clock will show the true time at regular but perhaps lengthy intervals.

You are given two Strings of the form "hh:mm:ss". The first represents exactly the true time, while the second is exactly the time shown by an ill-tuned clock. This is an analog clock whose hour, minute, and second hands sweep continuously around the dial at a speed that is too fast or too slow by a constant factor. Both times are given in the North American style, where the hour ranges between 1 and 12, inclusive. Given an int specifying the non-zero number of seconds that the clock gains every hour, calculate the number of hours that elapse before it agrees with the true time. Your answer, a double, must be correct with either absolute or relative precision of 1.0e-9 (one billionth).

### Definition

 Class: BadClock Method: nextAgreement Parameters: String, String, int Returns: double Method signature: double nextAgreement(String trueTime, String skewTime, int hourlyGain) (be sure your method is public)

### Notes

-If hourlyGain is negative, the clock falls behind by a fixed number of seconds every hour.
-It is not the case that the clock makes discrete jumps every so often. Rather, the hands of the clock are moving smoothly and continuously at a constant rate that is too slow or too fast relative to the true time.

### Constraints

-trueTime and skewTime each contain exactly eight characters in the format "hh:mm:ss", where the substring "hh" is a zero-padded integer between 1 and 12, inclusive, and "mm" and "ss" are zero-padded integers between 0 and 59, inclusive
-hourlyGain is either between -1800 and -1, inclusive, or between 1 and 3600, inclusive

### Examples

0)

 `"07:07:07"` `"07:07:07"` `1776`
`Returns: 0.0`
 The clock is already showing the true time.
1)

 `"11:59:58"` `"12:03:28"` `-3`
`Returns: 70.0`
 This clock loses three seconds every hour, and will catch up with the true time in exactly 70 hours.
2)

 `"12:03:28"` `"11:59:58"` `3`
`Returns: 70.0`
 This clock gains three seconds per hour.
3)

 `"03:03:02"` `"03:01:47"` `5`
`Returns: 15.0`
4)

 `"03:03:02"` `"03:01:47"` `-5`
`Returns: 8625.0`
5)

 `"07:08:09"` `"09:08:07"` `-321`
`Returns: 22.42367601246106`

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=1969

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=4665&pm=1969

Eeyore

#### Testers:

lbackstrom , brett1479

Math