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;
float floor2(float f) {
  if ((int)f == f) return f - 1;
  return floor(f);
}
int dig(int number, int digit) {
  return ((int)(number / pow(10, digit - 1))) % 10;
}
float idk(int k, int l) {
  int n = k, z = 0;
  for (int i = 1; i < l; i++) {
    n -= 9 * i * pow(10, i - 1);
    z += 9 * pow(10, i - 1);
  }
  float unk = (float)n / (float)l;
  return dig(ceil(unk + z), l - (n - floor2(unk) * l) + 1);
}
int getlength(int k) {
  int i = 0, n = k;
  while (true) {
    i++;
    if ((n = (n - 9 * i * pow(10, i - 1))) <= 0) {
      break;
    }
  }
  return i;
}
int main() {
  int k;
  cin >> k;
  cout << idk(k, getlength(k)) << endl;
}
