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 optimize("O3")
using namespace std;
const int MAX = 2e5 + 5;
const long long MAX2 = 11;
const long long MOD = 998244353;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 450;
long long n, le, ri, mid, res, mul, cnt, jlh, hit, pos;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  le = 1, ri = 1e12;
  while (le <= ri) {
    mid = le + ri >> 1;
    cnt = 1, mul = 9, hit = 0;
    while (mul < mid) {
      hit += (mul - mul / 10) * cnt;
      mul = mul * 10 + 9;
      ++cnt;
    }
    mul /= 10;
    hit += (mid - mul) * cnt;
    if (hit >= n)
      res = mid, pos = hit - n, ri = mid - 1;
    else
      le = mid + 1;
  }
  for (long long i = 1; i <= pos; ++i) res /= 10;
  cout << res % 10 << "\n";
  return 0;
}
