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;
using ll = long long;
ll f(ll n) {
  ll ret = 0, d1 = 1, d2 = 10;
  int d = log10(n);
  for (int i = 1; i <= d; i++) {
    ret += (d2 - d1) * i;
    d1 = d2, d2 *= 10LL;
  }
  ret += 1LL * (d + 1) * (n - d1 + 1);
  return ret;
}
vector<int> getDigit(ll n) {
  vector<int> v;
  while (n) v.push_back(n % 10), n /= 10;
  reverse(v.begin(), v.end());
  return v;
}
int main() {
  ll l = 1, h, m, k;
  scanf("%lld", &k);
  h = k;
  while (l < h) {
    m = (l + h) >> 1;
    ll cnt = f(m);
    if (cnt < k)
      l = m + 1;
    else
      h = m;
  }
  l -= f(l) >= k;
  k -= f(l);
  std::vector<int> v = getDigit(l + 1);
  printf("%d\n", v[k - 1]);
}
