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 *n *:* m* where *n* is the number of teeth on the rear sprocket and *m* is the number of teeth on the front sprocket. Two drive ratios *d*_{1 }<* d*_{2} are adjacent if there is no other drive ratio *d*_{1 }<* d*_{3 }<* d*_{2}. The *spread* between a pair of drive ratios *d*_{1 }<* d*_{2} is their quotient: *d*_{2} ⁄ *d*_{1}. You are to compute the maximum spread between two adjacent drive ratios achieved by a particular pair of front and rear clusters.

Input consists of several test cases, followed by a line containing 0. Each test case is specified by the following input:

*f*: the number of sprockets in the front cluster;*r*: the number of sprockets in the rear cluster;*f*integers, each giving the number of teeth on one of the gears in the front cluster;*r*integers, each giving the number of teeth on one of the gears in the rear cluster.

提交代码