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;
long long power2(long long n) {
  long long product = 1;
  for (long long i = 0; i < n; i++) product *= 10;
  return product;
}
void digitpb(vector<int> &V, long long i) {
  vector<int> C5;
  while (i > 0) {
    C5.push_back(i % 10);
    i = i / 10;
  }
  for (int j = 0; j < C5.size(); j++) V.push_back(C5[C5.size() - j - 1]);
}
int main() {
  long long k;
  cin >> k;
  long long sum = 0.1;
  int i;
  for (i = 1; i < 13; i++) {
    sum = sum + i * 9 * power2(i - 1);
    if (sum >= k) {
      sum -= 9 * i * power2(i - 1);
      k -= sum;
      break;
    }
  }
  long long dig;
  if (i == 1)
    dig = 0 + k;
  else {
    dig = pow(10.0, i - 1);
    if (k % i == 0)
      dig += k / i - 1;
    else
      dig += k / i;
  }
  vector<int> V;
  digitpb(V, dig);
  if (k % i == 0)
    cout << V[i - 1];
  else
    cout << V[k % i - 1];
  return 0;
}
