Let's write all the positive integer numbers one after another from 1 without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...

Your task is to print the k-th digit of this sequence.

Input

The first and only line contains integer k (1 ≤ k ≤ 10000) — the position to process (1-based index).

Output

Print the k-th digit of the resulting infinite sequence.

Examples

Input


7


Output


7


Input


21


Output


5
#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  if (n <= 9) {
    cout << n << endl;
    exit(0);
  } else if (n <= 9 + (90 * 2)) {
    n = n - 9;
    int jk = 9 + (n / 2);
    if (n % 2 == 1) {
      jk++;
      jk = jk / 10;
      cout << jk << endl;
    } else {
      cout << jk % 10;
    }
  } else if (n <= (9 + (90 * 2) + (900 * 3))) {
    n = n - 189;
    if (n % 3 == 0) {
      int jk = 99 + (n / 3);
      cout << jk % 10;
    } else if (n % 3 == 1) {
      int jk = 99 + (n / 3);
      jk++;
      jk = jk / 100;
      cout << jk;
    } else if (n % 3 == 2) {
      int jk = 99 + (n / 3);
      jk++;
      jk = jk / 10;
      cout << jk % 10;
    }
  } else {
    n = n - 2889;
    if (n % 4 == 0) {
      int jk = 999 + (n / 4);
      cout << jk % 10;
    } else if (n % 4 == 1) {
      int jk = 999 + (n / 4);
      jk++;
      jk = jk / 1000;
      cout << jk;
    } else if (n % 4 == 2) {
      int jk = 999 + (n / 4);
      jk++;
      jk = jk / 100;
      cout << jk % 10;
    } else if (n % 4 == 3) {
      int jk = 999 + (n / 4);
      jk++;
      jk = jk / 10;
      cout << jk % 10;
    }
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
