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;
void solve() {
  vector<long long> pi(13);
  pi[0] = 1;
  for (int i = 1; i < 13; i++) {
    pi[i] = 10 * pi[i - 1];
  }
  vector<long long> ui(13);
  ui[0] = 9;
  for (int i = 1; i < 13; i++) {
    ui[i] = 9 * pi[i] + ui[i - 1];
  }
  vector<int> li(13);
  for (int i = 0; i < 13; i++) li[i] = i + 1;
  vector<long long> mi(13);
  mi[0] = 1;
  for (int i = 1; i < 13; i++) {
    mi[i] = mi[i - 1] + li[i - 1] * (pi[i] - pi[i - 1]);
  }
  vector<long long> ri(13);
  for (int i = 0; i < 13; i++) ri[i] = mi[i] % li[i];
  long long n;
  cin >> n;
  if (n <= 9) {
    cout << n << endl;
    return;
  }
  int i;
  for (i = 0; i < 13 && n > mi[i]; i++)
    ;
  i--;
  long long k = pi[i] + (n - mi[i]) / li[i];
  string ks;
  while (k) {
    ks.push_back('0' + k % 10);
    k /= 10;
  }
  reverse(ks.begin(), ks.end());
  int d = (n - ri[i]) % li[i];
  cout << ks[d] << endl;
}
int main() {
  int t = 1;
  while (t--) solve();
}
