There is a sequence of N + 2 elements a0, a1,
,
aN+1 (1 ≤ N ≤ 3000,
−2000 ≤ ai ≤ 2000). It is known that
ai = (ai−1 + ai+1)/2 − ci
You are given a0, aN+1, c1, …, cN. Write a program which calculates a1.
Input
The first line contains an integer N. The next two lines consist of numbers a0 and aN+1 each having two digits after decimal point, and the next N lines contain numbers ci (also with two digits after decimal point), one number per line.
Output
Output a1 in the same format as a0 and aN+1.
Sample
input | output |
---|
1
50.50
25.50
10.15
| 27.85
|
Problem Author: Dmitry Filimonenkov
Problem Source: Ural State University collegiate programming contest (25.03.2000)