You are given the sequence: 0123456789101112131415...

The 0th digit of this sequence is 0, the 1st digit of this sequence is 1, the 2nd digit of this sequence is 2 and so on.

You will be given some queries. Each query will ask you to print the digit at the **ith** position for some **i**.

**Input:**

The first line of the input contains a single integer T denoting the number of test cases. Then** **T test cases follow. Each test case consist of one line which contains a positive integer **i**, which asks you to print the **ith** digit in the sequence given.

**Output:**

Corresponding to each test case, in a new line, print the digit at that position.

**Constraints:**

1 ≤ T ≤ 2000

1 ≤ Query Value ≤ 100000

**Example:**

**Input**

3

186

190

5

**Output**

9

1

5

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 140 |

xiaoyan_yunche | 139 |

ShameekAgarwal | 116 |

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 166 |

SoumyaKaushik | 146 |

arpit_anshuman | 140 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.