Approaching by progression#1997

Approaching by progression

1 second
64 megabytes
Very easy

Given a sequence of integers a_1, a_2, \ldots, a_N. Find an arithmetic progression b_1, b_2, \ldots, b_N for which the following value is minimized:

\sum_{i=1}^{N} (a_i - b_i)^2

Note that the elements of the progression do not need to be integers.

Input

The first line contains an integer (2 \leq N \leq 10^4) — the number of elements in the sequence. The second line contains integers a_1, a_2, \ldots, a_N, each with an absolute value not exceeding 10^4.

Output

Output two numbers separated by a space — the first term of the required arithmetic progression and its common difference, with an absolute or relative error not exceeding 10^{-6}. It is guaranteed that for all input data the answer is uniquely determined.

Examples

Example 1

Loading
Loading