Recovering the Common Ratio of a Geometric Sequence

Time limit1sMemory limit128 MB

Problem

A sequence of integers is called a geometric sequence if the ratio between consecutive terms is constant. For example, $(3, 6, 12, 24)$ is a geometric sequence in which each term is twice the previous one. This constant ratio is called the common ratio.

Someone took such a geometric sequence, shuffled its terms into an arbitrary order, and then removed some of them. Given the resulting collection of numbers, recover the common ratio of the original geometric sequence.

If several common ratios are possible, output the one with the greatest absolute value. If several of those tie in absolute value, output the positive one. If no geometric sequence contains all of the given numbers, output $0$.

Because the common ratio of an integer geometric sequence is always rational, the ratio may be a fraction such as $3/2$, not only an integer. A "possible common ratio" is a ratio $r$ for which there exists an integer geometric sequence that contains every given number as a term (in some order).

Input

The first line contains a single integer $N$, the count of integers in the transformed collection ($2 \le N \le 100,000$).

Each of the next $N$ lines contains one integer of the transformed collection. Every integer has absolute value at most $10^{18}$, and no integer is $0$.

Output

Output the common ratio as an exact reduced fraction.

  • Write the ratio as a fully reduced fraction $p/q$ and print it in the form p/q.
  • If the denominator $q$ equals $1$, print only the integer $p$.
  • If the ratio is negative, put a leading - on the numerator.
  • If no geometric sequence contains all of the given numbers, print 0.