#T348. 分数求和

分数求和

Description

Input nn fractions and sum them up, then express the result in its simplest form. The simplest form means that the greatest common divisor (GCD) of the numerator and denominator is 11; if the denominator of the final result is 11, represent it directly as an integer. Simplest Fraction.jpg Neither the numerator nor the denominator is 00 or negative.

Input Format

The first line is an integer nn, indicating the number of fractions, where 1n101 ≤ n ≤ 10; The next nn lines each contain a fraction in the form "p/qp/q", without spaces, where pp and qq do not exceed 1010.

Output Format

The output consists of only one line, which is the final result in its simplest form. If the result is a fraction, represent it in the form "p/qp/q".

2
1/2
1/3

5/6