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;
int sum(int n);
int main() {
  int k = 0;
  int re = 0;
  int no = 0;
  cin >> k;
  int p = 0;
  int i = 1;
  for (i = 1; i < 5; i++) {
    if (k < (int)(pow(10, i) + 0.5)) break;
  }
  p = i;
  if (p == 1) {
    cout << k << endl;
    return 0;
  }
  if (p == 2) {
    float nn = (float)(k - 9) / 2;
    no = ceil((nn));
    int d = (k - 9) % 2;
    int num = no + 9;
    for (int i = 0; i <= d; i++) {
      re = num % 10;
      num = num / 10;
    }
    cout << re << endl;
    return 0;
  } else {
    int s = sum(p - 1);
    int d = (k > s) ? p : (p - 1);
    int l = k - sum(d - 1);
    float nn = (float)l / d;
    no = ceil((nn));
    int r = d - (l % d);
    int num = no + (int)(pow(10, d - 1) + 0.5) - 1;
    re = 0;
    int noo = num;
    for (int i = 0; i <= r % d; i++) {
      re = noo % 10;
      noo = noo / 10;
    }
    cout << re << endl;
  }
}
int sum(int n) {
  if (n == 1) return 9;
  return (9 * n * (int)(pow(10, n - 1) + 0.5) + sum(n - 1));
}
