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 main() {
  unsigned long long k, n = 9, sum = 0, m = 0, t, s, d, q, r, p;
  int digs = 1, ans;
  string str;
  cin >> k;
  while (sum < k) {
    if (sum < k) {
      s = sum;
      d = digs;
      t = m;
    }
    sum = sum + digs * n;
    digs++;
    m += n;
    n *= 10;
  }
  q = ceil(1.0 * (k - s) / d);
  r = (k - s) % d;
  p = t + q;
  if (r == 0) {
    ans = p % 10;
  } else {
    str = to_string(p)[r - 1];
    ans = stoi(str);
  }
  cout << ans << "\n";
  return 0;
}
