Given a binary string S . The task is to perform R iterations on string S, in each iteration 0 becomes 01 and 1 becomes 10. Find the Nth character of the string after performing R iterations.
The first line consists of an integer T i.e number of test cases. The first and only line of each test case contains string S, and two Integers R and N respectively.
For each test case print the Nth character of string S after Rth iterations in new line.
0<=N<|Length of final string|
101 2 3
11 1 3