Candy Density

Choose a candy density d minimizing the sum of |W_i - d*C_i|, and print the minimum as an exact reduced fraction.

Medium6MathGreedySortingBinary searchInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Seongwon is a guest at an algorithm camp and makes candy for the participants. There are NN participants, numbered 0 to N1N-1.

Participant ii holds a basket with a capacity of CiC_i liters and wants to receive WiW_i grams of candy.

Seongwon fills every basket to its capacity, so participant ii receives exactly CiC_i liters of candy. He can make only one kind of candy, so a single density dd (grams per liter) applies to all of it. He may choose any positive real number for dd.

Once the density is dd, participant ii actually receives d×Cid \times C_i grams. To satisfy as many participants as possible, Seongwon picks the dd that minimizes the total difference between the requested weight and the received weight:

i=0N1Wid×Ci\sum_{i=0}^{N-1} \left| W_i - d \times C_i \right|

Write a program that computes this minimum.

Input

The first line contains the number of participants NN (1N501 \le N \le 50).

The second line contains C0,C1,,CN1C_0, C_1, \dots, C_{N-1} and the third line contains W0,W1,,WN1W_0, W_1, \dots, W_{N-1}, separated by spaces. (1Ci,Wi10000001 \le C_i, W_i \le 1000000)

Output

Print the minimum total difference on one line as a reduced fraction.

The minimum is always a rational number. Write it as p/qp / q, where pp is a nonnegative integer, qq is a positive integer, and gcd(p,q)=1\gcd(p, q) = 1. If q=1q = 1, print only p; otherwise print it in the form p/q. A decimal or an approximate value is not accepted.