Relay#6354

Relay

1 Sekunde
64 Megabyte
Sehr leicht

After Euro 2012, our renowned compatriots Kotyhoroshko, Vernygora, and Pan Kotsky made many new friends worldwide. This year, they decided to embark on a journey to visit these friends in various countries.

Their first destination was the Flower City, home to the shorties Neznaiko and his friends. Coincidentally, on the day of their arrival, a cycling relay race was underway, featuring bicycles crafted by Gvyntyk and Shpuntik. These unique bicycles each had a fixed speed, though the speeds varied between different bicycles.

Pan Kotsky decided to join the race, opting to ride the entire distance solo on a standard bicycle. What constant speed should Pan Kotsky maintain to complete the distance in the same time as the shorties? Note that all relay stages are of equal length.

Eingabe

st line: – the number of relay stages (1 \le K \le 1000).

nd line: M_1/N_1 M_2/N_2 ... M_K/N_K – the speeds of the shorties at each relay stage, expressed as simple fractions separated by spaces. M_i, N_i – integers (1 \le M_i, N_i \le 10).

Ausgabe

– the required speed of Pan Kotsky, presented as a simple irreducible fraction.

Beispiele

Beispiel 1

Loading
Loading