Ride My Bicycle

No attempts yetTime limit1sMemory limit128 MB

Problem

A bicycle has 3 chain rings on the crank (the gears attached to the pedals) at the front and 7 gears on the back wheel. The chain connects exactly one front chain ring to one back gear, and the derailleurs can switch the chain to any combination of the 3 front chain rings and 7 back gears, giving 3×7=213 \times 7 = 21 possible combinations.

The ease of pedalling is determined by the ratio of the number of teeth on the chosen chain ring to the number of teeth on the chosen back gear. The smaller this ratio, the easier it is to pedal. Given the number of teeth on each gear, write a program that reports the gear ratio for every combination.

Input

The input consists of two lines.

  • Line 1: three distinct positive integers separated by single spaces, in strictly increasing order, giving the number of teeth on each front chain ring. From smallest to largest they are chain rings 1, 2, and 3.
  • Line 2: seven distinct positive integers separated by single spaces, in strictly increasing order, giving the number of teeth on each back gear. From smallest to largest they are back gears 1 through 7.

You may assume that every gear ratio is less than 1010.

Output

Print 21 lines. Each line describes one combination and has the form

x.xx f b

  • f is the chain ring number (1f31 \le f \le 3),
  • b is the back gear number (1b71 \le b \le 7),
  • x.xx is (teeth on chain ring ff) / (teeth on back gear bb) rounded to two decimal places.

The three fields are separated by single spaces. Print the lines from smallest ratio to largest; if two or more ratios are equal, print the one with the smaller chain ring number first.