Question:
Problem description
Dr. Kong designed a forward or backward robot. The robot will get a mobile step number command ki (I = 1, 2... N) A smart robot will determine whether to move forward or backward the ki step.
For example, a given command sequence (3, 1, 2, 5) indicates that a robot can move three steps forward to 1st positions at 4th positions. In this case, the backend operation does not work and the robot goes out of bounds; when the robot is in the third position, it can move forward three steps to the third position. In this case, the backend operation does not work and the robot goes out of bounds. When the robot is in the third position, you can move one step to 4th positions, or move one step to 2nd positions.
In your opinion, How many times should a smart robot at least judge the given two positions A and B from position a to position B?
Input
Standard Input]
The first line: M indicates that the following M groups of test data (0 <m <= 8)
Next, each group has two rows of data.
First line: n a B (1 ≤ n ≤ 50, 1 ≤ a, B ≤ n)
Next line: K1 K2 ..... KN (0 <= Ki <= N)
Output
Standard output]
The output contains m rows. The I act is the minimum number of times the I group test data is judged. If it cannot be reached, the output is-1.
Sample Input
2
5 1 5
3 3 1 2 5
8 5 3
1 2 1 5 3 1 1
Sample output
3
-1