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() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long k, ost;
  cin >> k;
  if (k < 10) {
    cout << k;
    return 0;
  }
  long long d = 0;
  for (int g = 10000; g >= 10; g /= 10) {
    if (k >= g) {
      if (k < g * 10) {
        long long r = 0, gg = g;
        while (gg != 0) {
          ++r;
          gg /= 10;
        }
        d += (k - g + 1) * (r - 1);
      } else {
        long long r = 0, gg = g;
        while (gg != 0) {
          ++r;
          gg /= 10;
        }
        d += (g * 10 - g) * (r - 1);
      }
    }
  }
  for (int i = 10000; i >= 10; i /= 10) {
    if (i <= k) {
      int kol = (k - i + 1);
      int r = 0, ii = i;
      while (ii != 0) {
        ++r;
        ii /= 10;
      }
      kol *= r;
      if (d >= kol) {
        k = i - 1;
        d -= kol;
      } else {
        ost = d % r;
        d /= r;
        k -= d;
        break;
      }
    }
  }
  while (ost > 0) {
    k /= 10;
    --ost;
  }
  cout << k % 10;
  return 0;
}
