Problem C. Calculate a limit

Author:A. Klenin   Time limit:1 sec
Input file:input.txt   Memory limit:64 Mb
Output file:output.txt  

Statement

Your program must calculate the value of limxa1x + a2x2 + …  + anxnb1x + b2x2 + …  + bnxn.

All coefficients are integers, so the answer must be calculated exactly and presented in the form of irreducible fraction.

Input file format

Input file contains integer n followed first by n integers a1 a2… an and then by n integers b1 b2… bn.

Output file format

Output file must contain two integers — nominator and denominator of the fraction. If the limit is zero, output integers 0 1. If the limit is infinity, output integers 1 0.

Constraints

1 ≤ n ≤ 100, 0 ≤ ai, bi ≤ 109, i (bi + ai) > 0

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
1
2 4
1 2
2
2
0 1  1 0
1 0

0.057s 0.008s 13