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>
int main() {
  int n, m, index;
  scanf("%d", &n);
  if (n < 10) {
    printf("%d", n);
    return 0;
  }
  if (n <= 189) {
    n = n - 9;
    if (n % 2 == 0) {
      m = 10 + ((n / 2) - 1);
      index = m % 10;
    } else if ((n % 2) != 0) {
      m = 10 + (n / 2);
      index = m / 10;
    }
  } else if (n <= 2889 && n > 189) {
    n = n - 189;
    if (n % 3 == 0) {
      m = 100 + ((n / 3) - 1);
      index = m % 10;
    } else if (n % 3 == 2) {
      m = 100 + (n / 3);
      m = m / 10;
      index = m % 10;
    } else if (n % 3 == 1) {
      m = 100 + (n / 3);
      index = m / 100;
    }
  } else {
    n = n - 2889;
    if (n % 4 == 0) {
      m = 1000 + ((n / 4) - 1);
      index = m % 10;
    } else if (n % 4 == 3) {
      m = 1000 + (n / 4);
      m = m / 10;
      index = m % 10;
    } else if (n % 4 == 2) {
      m = 1000 + (n / 4);
      m = m / 100;
      index = m % 10;
    } else if (n % 4 == 1) {
      m = 1000 + (n / 4);
      index = m / 1000;
    }
  }
  printf("%d", index);
  return 0;
}
