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 printprecise(double l, long long int precision) {
  std::cout << std::fixed;
  std::cout << std::setprecision(precision);
  std::cout << l;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void initialize(long long int ar[], long long int n) {
  for (long long int x = 0; x < n; x++) ar[x] = x;
}
void printarray(long long int ar[], long long int n) {
  for (long long int x = 0; x < n; x++) cout << ar[x] << " ";
  cout << endl;
}
long long int root(long long int i, long long int ar[]) {
  while (ar[i] != i) {
    ar[i] = ar[ar[i]];
    i = ar[i];
  }
  return i;
}
void unione(long long int a, long long int b, long long int ar[]) {
  long long int p = root(a, ar);
  long long int q = root(b, ar);
  ar[p] = ar[q];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int k;
  cin >> k;
  long long int t = k;
  long long int r = 0;
  while (k > 0) {
    k = k - 9 * round(pow(10, r)) * (r + 1);
    r++;
  }
  long long int s = 0;
  for (long long int x = 1; x < r; x++) {
    s = s + x * 9 * round(pow(10, x - 1));
  }
  t = t - s;
  long long int t1 = t / r;
  long long int p = t1 + round(pow(10, r - 1)) - 1;
  if (t % r == 0) {
    cout << p % 10;
  } else {
    p++;
    p = p / round(pow(10, r - t % r));
    cout << p % 10;
  }
}
