Lost Lineup

Interview

Time limit1sMemory limit512 MB

Summary
Given each of Jimmy's friends' distance (number of people between them and Jimmy) from the front, reconstruct the original lineup with Jimmy first.
Level

Easy3 of 10

Topics
Array, Sorting, Implementation, Brute force
Solved
No attempts yet

Problem

Jimmy and his friends were standing in a lineup for ice cream when a huge gust blew them all around. The friends want to keep things fair and make sure everyone gets their ice cream in the order they started with. The friends do not remember the order, but each of them remembers exactly how many people were between them and Jimmy. Jimmy is always the first person in line. Can you help him and his friends remember the order?

Input

The first line contains a single integer nn (1≤n≤1001 \le n \le 100), the number of people in the line.

The second line contains n−1n - 1 space separated integers, where did_i (0≤di≤n−20 \le d_i \le n - 2) is the number of people between the (i+1)(i + 1)th person and Jimmy.

Jimmy is always first in the lineup.

Output

Print a single line with nn integers, the people in the order of the original lineup. It is guaranteed that there is always a unique solution.

Examples2

  1. Example 1

    Input
    2
    0
    
    Expected output
    1 2
    
  2. Example 2

    Input
    4
    1 2 0
    
    Expected output
    1 4 2 3