Problem O
Tour de France
A racing bicycle is driven by a chain connecting two
sprockets. Sprockets are grouped into two clusters: the front
cluster (typically consisting of 2 or 3 sprockets) and the rear
cluster (typically consisting of between 5 and 10 sprockets).
At any time the chain connects one of the front sprockets to
one of the rear sprockets. The drive ratio – the ratio of the
angular velocity of the pedals to that of the wheels – is
Input
Input consists of several test cases, followed by a line containing 0. Each test case is specified by the following input:
-
: the number of sprockets in the front cluster; -
: the number of sprockets in the rear cluster; -
integers, each giving the number of teeth on one of the gears in the front cluster; -
integers, each giving the number of teeth on one of the gears in the rear cluster.
You may assume that no cluster has more than
Output
For each test case, output the maximum spread rounded to two decimal places.
Sample Input 1 | Sample Output 1 |
---|---|
2 4 40 50 12 14 16 19 0 |
1.19 |