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 **N**th character of the string after performing **R**** **iterations.

**Input:**

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.

**Output:**

For each test case print the **N**th character of string **S** after **R**th iterations in new line.

**Constraints:**

1<=T<=100

1<=|string length|<=1000

1<=R<=20

0<=N<|Length of final string|

**Example:
Input:**

2

101 2 3

11 1 3

**Output:**

1

0

may55 | 86 |

ashujack | 84 |

aman19 | 82 |

abbatta7 | 75 |

lakshmi_pandey | 74 |

saumitra13325 | 648 |

ashujack | 591 |

aman19 | 562 |

lakshmi_pandey | 546 |

aroma17 | 535 |

blackshadows | 5249 |

akhayrutdinov | 5111 |

Ibrahim Nash | 5087 |

Quandray | 4354 |

sanjay05 | 3668 |

Login to report an issue on this page.