#P15444. 「IXOI R1」出题人完全不会给题目起名字
「IXOI R1」出题人完全不会给题目起名字
Description
You are given a sequence of positive rational numbers of length , we define an operation as:
Choose an index , then , let .
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 : the length of the sequence.
Then the next lines, line contains two space separated positive integers , indicating that .
Output Format
One line, two positive integers , indicating that the minimum value is .
Note that the fraction you output must be the simplest fraction. In particular, if the simplified result is an integer, is expected to be .
5
4 3
22 8
3 99
4 3
17 43
4 363
Hint
Example Explanation
Carry out operations for times, selecting indices . The minimum value is , it can be proved that no smaller value exists.
Constraints
This problem uses bundled testing.
| Subtask Id | Points | |
|---|---|---|
For all data, it is guaranteed that:
,.
京公网安备 11011102002149号