Sequence Simplification
Help Alice simplify a sequence of fractional numbers. You are given N real numbers. The task involves performing a series of steps where, in each step, a new sequence is created. Each number in this new sequence is the absolute difference between two consecutive numbers from the previous sequence. These steps are repeated until only one number remains. Your goal is to determine the final number after all the steps have been completed.
Input
The first line contains an integer N – the number of numbers (1 < N ≤ 1000). The second line contains the fractional numbers C[i]
, where 1 ≤ i ≤ N.
Output
Print the final number obtained after executing the described process.
Examples
Note
For the sequence 12.5 12 13.5 14.5 15.5:
First step results in 0.5 1.5 1 1
Second step results in 1 0.5 0
Third step results in 0.5 0.5
Fourth step results in 0