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() {
  float k;
  cin >> k;
  float a = 0;
  int b = 0;
  float c = 0;
  if (k < 10) {
    cout << k;
  }
  if (k >= 10 && k <= 189) {
    a = 9 + (k - 9) / 2;
    b = a;
    if (b != a) {
      b = b + 1;
      cout << b / 10;
    } else {
      cout << b % 10;
    }
  }
  if (k > 189 && k <= 2889) {
    a = 99 + ((k - 189) / 3);
    b = a;
    c = a - b;
    if (b != a) {
      b = b + 1;
      if (c < 0.5) {
        cout << b / 100;
      }
      if (c > 0.5 && c < 0.7) {
        cout << (b / 10) % 10;
      }
    } else {
      cout << b % 10;
    }
  }
  if (k > 2889) {
    a = 999 + (k - 2889) / 4;
    b = a;
    c = a - b;
    if (a != b) {
      b = b + 1;
      if (c < 0.3) {
        cout << b / 1000;
      }
      if (c > 0.3 && c < 0.6) {
        cout << (b / 100) % 10;
      }
      if (c > 0.6) {
        cout << (b / 10) % 10;
      }
    } else {
      cout << b % 10;
    }
  }
}
