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;
const long long mod = 1e9 + 7;
const int dx[8] = {0, -1, 0, 1, -1, -1, 1, 1},
          dy[8] = {1, 0, -1, 0, -1, 1, -1, 1};
long long qk(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x;
    y >>= 1;
    x *= x;
  }
  return ans;
}
string str1;
void solve() {
  long long k = 1;
  long long p = 9;
  long long x;
  cin >> x;
  while (p < x) {
    x -= p;
    k++;
    p = 9ll * qk(10, (k - 1)) * k;
  }
  p = (x + k - 1) / k;
  x -= (p - 1) * k;
  long long z = (qk(10, (k - 1)) - 1 + p);
  x = (k + 1 - x);
  while (x--) {
    if (x == 0) {
      cout << z % 10;
    } else {
      z /= 10;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  ;
  solve();
  return 0;
}
