You are building a board game "COBOOOL Sugoroku" for smart phones. The "COBOOOL Sugoroku" have "n" lined cells from 1st cell to n-th cell. Each cell holds one integer value written.
First, you are at the first cell. You'll spin a wheel, and you'll see one number on the wheel. Then you'll move forward (to the n-th cell) by the number on the wheel.
Next, if the value of the cell is a positive number, you'll move forward (to the n-th cell) by the value of the cell. If the value of the cell is a negative number, you'll move backward (to the first cell). And again, you'll repeatedly see the value of the current cell, and move by the value. If there is no cell on the position where you'll move to, you'll stop moving and the game ends.
The following figure shows one example values of cells with n = 8:
On the cells, you'll move like:
If the wheel shows 7, you'll move: 1 -> 8, and the game ends.
If the wheel shows 3, you'll move: 1 -> 4 -> 2 -> 8, and the game ends.
If the wheel shows 4, you'll move: 1 -> 5, and the game ends.
If the wheel shows 2, you'll move: 1 -> 3 -> 1, and the game ends.
If the wheel shows 5, you'll move: 1 -> 6 -> 7 -> 6 , and the game ends.
If the wheel shows 10, you won't move, and the game ends.
The following figure shows the moves:
You are given the values of cells and the numbers wheel shows. Write a program that checks whether you will reach the n-th cells and output "Yes" or "No".