This page is still under construction.

Parts of this page are still being built. What you see may change.

The Motorway

Time limit6sMemory limit128 MB

Summary
Given sorted entry positions, find the smallest and largest even toll spacing that puts one entry between consecutive tolls, printed as reduced fractions.
Level

Hard8 of 10

Topics
Math, Geometry, Binary search
Solved
No attempts yet

Problem

Autobyte is building one of the motorways of Byteland. Until recently the company collected a toll only at the start of the motorway, so the amount a driver paid did not depend on the distance he covered in bytemiles. The new chairman, Byteasar, decided to place toll points along the whole motorway.

On one of his trips Byteasar used the odometer of his car to write down the positions of all nn entry points. The position of an entry point is its distance from the start of the motorway. The company will build n+1n+1 toll points spaced evenly, so the distance between two consecutive toll points is the same everywhere. Between every two consecutive toll points there has to be an entry point, and between every two consecutive entry points there has to be a toll point. The positions Byteasar wrote down do allow such an arrangement.

Formally, look for the spacings ℓ\ell for which a position b0b_0 of the first toll point exists such that the remaining toll points stand at b0+ℓb_0 + \ell, b0+2ℓb_0 + 2\ell, ..., b0+nℓb_0 + n\ell and entry point jj satisfies

b0+(j−1)ℓ≤aj≤b0+jℓ.b_0 + (j-1)\ell \le a_j \le b_0 + j\ell.

A toll point may land exactly on an entry point. The booth is then built immediately before or immediately after it, which is why the interval above is closed.

Find the smallest and the largest spacing ℓ\ell that admits such an arrangement.

Input

The first line contains one integer nn, the number of entry points (3≤n≤1063 \le n \le 10^6).

The second line contains nn integers a1<a2<⋯<ana_1 < a_2 < \dots < a_n, the positions of the entry points in increasing order (0≤ai≤1090 \le a_i \le 10^9).

The given positions always admit at least one valid arrangement, and the smallest and the largest spacing differ by at least 10−910^{-9}.

Output

Print the smallest spacing and the largest spacing between two consecutive toll points, in that order, on one line separated by a single space.

Both answers are rational, so print each one as an exact fraction p/q in lowest terms, with q>0q > 0 and gcd⁡(p,q)=1\gcd(p, q) = 1. Write the denominator even when it is 11, so a spacing of 33 is printed as 3/1.

Examples2

  1. Example 1

    Input
    6
    2 3 4 5 6 7
    
    Expected output
    5/6 5/4
    
  2. Example 2

    Input
    3
    0 1 2
    
    Expected output
    2/3 2/1