We are playing a game and there will be only one winner in this game eventually. Initially, we have a set of people who form a circle. Then, given a start person, we iteratively remove one person based on certain rule, until only one person left. The last person is called the winner.
The rule is
Example:
3 (the number of people, there IDs are 1, 2, 3 in this case and form a circle clockwised)
4 3 2 (the QQ values of the persons respectively. That is, the person with ID=1 has QQ value=4)
1 (the start person’s ID)
First line: total number of people in this game
Second line: the QQ values of the people
Third line: start person’s ID

Note:
NO STL are allowed.
Time and memory are both limited.
<string> is allowed
0 < Number of people < 1,000,000
QQ Value is an integer but except 0
1 <= The start person's ID <= Number of people
May have several testcases
Output the winner's ID