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 int INF = 1000000000;
const int maxn = 100;
const int MAXN = 2750131;
long long T, n, m, i, j;
long long gcd(long long p, long long q) { return q == 0 ? p : gcd(q, p % q); }
long long g[200005];
int main() {
  ios::sync_with_stdio(false);
  long long a[20];
  long long k = 1, s = 1, sum = 9;
  for (i = 0; s < 1e12; i++) {
    a[i] = s * sum * k;
    s *= 10;
    k++;
  }
  cin >> n;
  if (n < 10) {
    cout << n << endl;
    return 0;
  }
  sum = 0;
  i = 0;
  k = 1;
  s = 1;
  long long m = n;
  while (m > a[i]) {
    m -= a[i];
    i++;
    k++;
    s = pow(10, i);
    sum = s - 1;
  }
  long long ans = (m) / k + sum;
  if (m % k) {
    ans++;
  }
  long long sk = m % k;
  if (sk == 0) {
    sk = k;
  }
  while (ans > 0) {
    if (sk == k) {
      cout << ans % 10 << endl;
      break;
    } else {
      ans /= 10;
      k--;
    }
  }
  return 0;
}
