Jeongmin is a single-celled organism. The name JMPABU (JeongMin is Paramecium & Amoeba Based Unicellular organism) says as much: it looks like a paramecium crossed with an amoeba. I watched Jeongmin for a little over a year and found two properties.
I own a single generation 0 Jeongmin, and I numbered it 0. Its descendants get numbers too. Take the smallest-numbered Jeongmin whose children are not numbered yet, then give its children the smallest unused numbers in birth order. Repeating that produces the numbering in the picture below.

I keep running experiments on which birth order leads to the disease. The method is simple: follow the birth orders one step at a time and examine the Jeongmin you land on. For example, look at the 1st child born to the generation 0 Jeongmin, then the 2nd child born to that one, then the 1st child born to that one. Along that path the numbers you see are 1, 3 and 7, in that order. Once the generation count grows the numbers get far too large to follow by hand. I need your help.
The first line contains the generation D (1≤D≤100) you want to examine.
The second line contains D integers separated by spaces. The i-th integer di (1≤di≤i) means you look at the di-th child born to the generation i−1 Jeongmin.
Print D lines. On line k, print the number of the generation k Jeongmin you see while following the input. The number can be very large, so print it modulo 1,000,000,007.