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 k;
  cin >> k;
  long long l = 1, r = 12;
  while (l < r) {
    long long mid = (l + r) / 2;
    long long sum = 0;
    for (int i = 1; i <= mid; i++) {
      sum += 9LL * ((long long)pow(10LL, i - 1)) * (i);
    }
    if (k <= sum) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  long long num = 0;
  for (int i = 1; i < r; i++) {
    num = num + ((long long)pow(10LL, i - 1)) * i * 9LL;
  }
  num = k - num;
  int tofind;
  if (num % r == 0) {
    num = num / r - 1;
    tofind = 0;
  } else {
    tofind = r - (num % r);
    num = num / r;
  }
  num = ((long long)pow(10LL, r - 1) - 1) + num + 1;
  int cnt = 0;
  while (num > 0) {
    int dig = num % 10;
    if (cnt == tofind) {
      cout << dig;
      return 0;
    }
    cnt++;
    num = num / 10;
  }
}
