SP4416 JUMP1 - Jumping Hands
Description
In Shanghai, there are some famous clock towers built more than 100 years ago, such as the office building of Shanghai Customs, Xujiahui Church, etc. Every clock tower’s clock-face consists of three hands: an hour hand, a minute hand, and a second hand. The hands are not move smoothly as time passing. When a second passes, the hands jump to the next place clockwise: the second hand moves 1/60 ring, the minute hand moves 1/3600 ring and the hour hand moves 1/43200 ring.
We assume that every hand’s mass is evenly distributed, and its thickness can be ignored. In other words, every hand’s centre of gravity is at the middle position of the respective hand. Suppose _p_ $ _{1} $ , _p_ $ _{2} $ and _p_ $ _{3} $ are, respectively, the position of the centre of gravity of the hour hand, that of the minute hand, and that of the second hand. The position of all three hands’ centre of gravity, _P_, is the average of _p_ $ _{1} $ , _p_ $ _{2} $ and _p_ $ _{3} $ weighted by the hands’ mass.
Suppose _P_ $ _{1} $ and _P_ $ _{2} $ are the positions of the three hands’ centre of gravity at the start time and at the end time, respectively. Your task is to calculate the length of the path from _P_ $ _{1} $ to _P_ $ _{2} $ . That is, if _P_ $ _{3} $ is the position of the three hands’ centre of gravity on the clock-face at a point of time between start time and end time, _X_ is the length of the path from _P_ $ _{1} $ to _P_ $ _{3} $ , and _Y_ is the length of the path from _P_ $ _{3} $ to _P_ $ _{2} $ , the length of the path from _P_ $ _{1} $ to _P_ $ _{2} $ is _X+Y_.
Input Format
Input consists of one or more lines, each line describing one data set. Each line begins with 6 integers: _L_ $ _{1} $ , _L_ $ _{2} $ , _L_ $ _{3} $ , _M_ $ _{1} $ , _M_ $ _{2} $ , _M_ $ _{3} $ , followed by start time and end time. _L_ $ _{1} $ , _L_ $ _{2} $ and _L_ $ _{3} $ indicate the lengths of hour hand, minute hand and second hand respectively, where 1
Output Format
For each data set, output a single line. Each line should give the length of the path for the positions of three hands’ centre of gravity at the start time and at the end time. We accept solutions with absolute error less than 10 $ ^{-2} $ .