Wael is playing a game called Balls and Boxes. There are N boxes in a row, each box i
has a strength S[i].
It is given that Wael can initially throw a ball into any box he wants. When a ball gets
inside some box i, two things will happen:
O
First, this ball will now jump into the box (i + S[i])
Second, the strength of the box i will get decreased by 1. If the strength of box i is
equal to 1, it won't be changed.
Wael wants to make the strength S[i] equal to 1 for all (1 <= i <= N). Your task is to find
the minimum number of balls that he needs to throw manually. Since the answer can be
large return the final answer modulo 10^9+7.
Input Format
The first line contains an integer, N, denoting the number of boxes.
The next N lines contains an integer, S[], denoting the strength of i-th box.
Answers
Answered by
0
Answer:
this much only marks for this much
Similar questions