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 int func(long long int m, long long int digit) {
  digit--;
  long long int ans = 1;
  while (digit--) {
    ans *= 10;
  }
  return ans + m - 1;
}
long long int mod = 1000000007;
int main() {
  long long int k;
  cin >> k;
  long long int digit = 1, n = 9;
  while (k - (digit * n) > 0) {
    k = k - (digit * n);
    digit++;
    n *= 10;
  }
  long long int tmp = k / digit;
  long long int md = k % digit;
  if (md > 0) tmp += 1;
  if (tmp == 0) {
    cout << 9;
  } else {
    long long int ans = func(tmp, digit);
    string s = to_string(ans);
    if (md == 0) {
      cout << s[digit - 1];
    } else {
      cout << s[md - 1];
    }
  }
  return 0;
}
