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 N = 1e9 + 7;
long long pow(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = ((res) * (x));
    res %= N;
    y = y >> 1;
    x = ((x) * (x));
  }
  return res;
}
long long powm(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
void solve() {
  long long k;
  cin >> k;
  long long curval, curdig, totdig;
  totdig = k;
  curval = 0;
  curdig = 1;
  long long temp = 9;
  while (1) {
    if (totdig > temp * curdig) {
      totdig -= temp * curdig;
      curval += temp;
      curdig++;
      temp *= 10;
    } else {
      break;
    }
  }
  long long a = curval + totdig / curdig;
  long long b = totdig % curdig;
  a++;
  if (b == 0) {
    cout << (a - 1) % 10;
  } else {
    string s;
    while (a > 0) {
      s += (a % 10 + '0');
      a /= 10;
    }
    reverse(s.begin(), s.end());
    cout << s[b - 1];
    return;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
