cho.sh
Notes
Loading...

Candy

Time limit

2s

Memory limit

128 MB

Problem

An odd number N of students are sitting in a circle. They are numbered from 1 to N in counterclockwise order, and student 1 sits to the right of student N.

Each student has between 0 and 100,000 candies, inclusive. Different students may have different numbers of candies.

You are given, in order, the sum of candies held by each adjacent pair: students 1 and 2, students 2 and 3, ..., students N-1 and N, and finally students N and 1.

Using this information, determine how many candies each student has.

Input

The first line contains the odd integer N. (3 <= N <= 999)

Each of the next N lines contains one adjacent-pair sum in order. The i-th value is the sum for students i and i+1, and the N-th value is the sum for students N and 1.

Output

Print N lines. The i-th line must contain the number of candies held by student i.

The input is guaranteed to have a valid answer, and all printed values must be nonnegative integers.