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>
#pragma GCC optimize("O3")
using namespace std;
void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
long long k, ile;
bool git(long long x) {
  long long hm = 0, tt = x;
  ile = 0;
  while (tt) {
    ++hm;
    tt /= 10;
  }
  long long pot = 1;
  for (long long i = 1; i < hm; ++i) {
    ile += 9 * i * pot;
    pot *= 10;
  }
  ile += hm * (x - pot);
  return ile < k;
}
signed main() {
  init_ios();
  cin >> k;
  long long x1 = 1, x2 = k + 3, x3;
  while (x2 - x1 > 1) {
    x3 = (x1 + x2) / 2;
    if (git(x3))
      x1 = x3;
    else
      x2 = x3;
  }
  git(x1);
  k -= ile;
  string bla = to_string(x1);
  cout << bla[k - 1] << "\n";
}
