ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1047. Simple Calculations

Time limit: 1.0 second
Memory limit: 64 MB
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
for each i = 1, 2, …, N.
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

inputoutput
1
50.50
25.50
10.15
27.85
Problem Author: Dmitry Filimonenkov
Problem Source: Ural State University collegiate programming contest (25.03.2000)