Under construction

Still being built. Things may change

Triangle Addition

Time limit2sMemory limit2048 MB

Summary
Given a sequence, the task repeatedly sums adjacent pairs to build a triangle and prints each row of the triangle.
Level

Easy1 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Statement

N integers are written on a blackboard from left to right.

The i-th integer from the left is A_i.

For the integer sequence on the blackboard, repeat the following operation.

Operation

Let k be the length of the integer sequence in the bottom row of the blackboard. Referring to the values of this sequence, write below it a new sequence of length k - 1.

For each i = 1, 2, ..., k-1, the i-th integer of the new sequence is the sum of the i-th and (i+1)-th integers of the referenced sequence.

Perform this operation N-1 times. Find all the integer sequences written on the blackboard.

Input

The input is given in the following format.

N
A1 A2 … AN

Output

Print the integer sequences written on the blackboard in the N-1 operations, one sequence per line in N-1 lines.

On the i-th line (1 ≦ i ≦ N), print the sequence written in the i-th operation, separated by spaces.

Print only the answer. Do not print any prompt or other text.

Constraints

  • 2 ≦ N ≦ 10.
  • 1 ≦ Ai ≦ 10 (1 ≦ i ≦ N).
  • All input values are integers.

Examples3

  1. Example 1

    Input
    5
    1 3 5 7 9
    
    Expected output
    4 8 12 16
    12 20 28
    32 48
    80
    
  2. Example 2

    Input
    7
    1 2 3 4 3 2 1
    
    Expected output
    3 5 7 7 5 3
    8 12 14 12 8
    20 26 26 20
    46 52 46
    98 98
    196
    
  3. Example 3

    Input
    10
    1 9 2 4 4 9 2 3 5 6
    
    Expected output
    10 11 6 8 13 11 5 8 11
    21 17 14 21 24 16 13 19
    38 31 35 45 40 29 32
    69 66 80 85 69 61
    135 146 165 154 130
    281 311 319 284
    592 630 603
    1222 1233
    2455