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>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unrolled-loops")
using namespace std;
const long long mod = 1e9 + 7;
int test = 1;
const int N = 100100;
long long n;
int k = 1;
long long x = 1;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  if (n > 9) {
    n -= 9;
    k++;
    x *= 10;
  }
  if (n > 180) {
    n -= 180;
    k++;
    x *= 10;
  }
  if (n > 2700) {
    n -= 2700;
    k++;
    x *= 10;
  }
  if (n > 36000) {
    n -= 36000;
    k++;
    x *= 10;
  }
  if (n > 450000) {
    n -= 450000;
    k++;
    x *= 10;
  }
  if (n > 5400000) {
    n -= 5400000;
    k++;
    x *= 10;
  }
  if (n > 63000000) {
    n -= 63000000;
    k++;
    x *= 10;
  }
  if (n > 720000000) {
    n -= 720000000;
    k++;
    x *= 10;
  }
  if (n > 8100000000) {
    n -= 8100000000;
    k++;
    x *= 10;
  }
  if (n > 90000000000) {
    n -= 90000000000;
    k++;
    x *= 10;
  }
  if (n > 990000000000) {
    n -= 990000000000;
    k++;
    x *= 10;
  }
  long long m, l;
  m = n / k;
  l = n % k;
  x += m - 1;
  if (l == 0)
    cout << x % 10;
  else {
    x++;
    while (k > l) {
      k--;
      x /= 10;
    }
    cout << x % 10;
  }
}
