#P15444. 「IXOI R1」出题人完全不会给题目起名字

    ID: 15317 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>贪心洛谷原创O2优化洛谷月赛

「IXOI R1」出题人完全不会给题目起名字

Description

You are given a sequence ai(i[1,n])a_i(i\in[1,n]) of positive rational numbers of length nn, we define an operation as:

Choose an index jj, then i[1,n]\forall i\in[1,n], let aiaiaja_i\gets\frac{a_i}{a_j}.

Find out the minimum value of the sequence after operations are carried out any number of times.

Input Format

The first line of the input contains a single positive integer nn: the length of the sequence.

Then the next nn lines, line i+1i+1 contains two space separated positive integers xi,yix_i,y_i, indicating that ai=xiyia_i=\frac{x_i}{y_i}.

Output Format

One line, two positive integers x,yx,y, indicating that the minimum value is xy\frac{x}{y}.

Note that the fraction you output must be the simplest fraction. In particular, if the simplified result is an integer, yy is expected to be 11.

5
4 3
22 8
3 99
4 3
17 43

4 363

Hint

Example Explanation

Carry out operations for 44 times, selecting indices 5,4,1,25,4,1,2. The minimum value is 4363\frac{4}{363}, it can be proved that no smaller value exists.

Constraints

This problem uses bundled testing.

Subtask Id nn\le Points
00 1010 2020
11 50005000
22 10610^6 6060

For all data, it is guaranteed that:

2n1062\le n\le 10^6i[1,n],0<xi,yi109\forall i\in[1,n],0<x_i,y_i\le 10^9.