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;
int main() {
  long long n, a = 0, b, c, d, e = 1;
  string s;
  cin >> n;
  if (n < 10) {
    cout << n;
    return 0;
  }
  while (n > a) {
    a += 9 * e * pow(10, e - 1);
    e++;
  }
  a -= 9 * (e - 1) * pow(10, e - 2);
  c = n - a;
  d = c / (e - 1);
  if (c % (e - 1) == 0) {
    b = pow(10, e - 2) - 1 + d;
    cout << b % 10 << endl;
  } else {
    b = pow(10, e - 2) + d;
    s = to_string(b);
    cout << s[c - d * (e - 1) - 1] << endl;
  }
  return 0;
}
