#P1037. 数字查询 (Digit Queries)

数字查询 (Digit Queries)

Source: CSES Problem Set (Task 2431)
Link: https://cses.fi/problemset/task/2431
Category: Introductory Problems

  • Time limit: 1.00 s
  • Memory limit: 512 MB

Consider an infinite string that consists of all positive integers in increasing order:

12345678910111213141516171819202122232425...

Your task is to process qq queries of the form: what is the digit at position kk in the string?

Input

The first input line has an integer qq: the number of queries.

After this, there are qq lines that describe the queries. Each line has an integer kk: a 11-indexed position in the string.

Output

For each query, print the corresponding digit.

Constraints

  • 1≤q≤10001 \le q \le 1000
  • 1≤k≤10181 \le k \le 10^{18}

Example

Input:

3
7
19
12

Output:

7
4
1