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 N = (int)4e4, OO = 0x3f3f3f3f;
long long getSum(long long r) { return (r + 1) * r / 2; }
long long sumSoFar(long long r) {
  long long pw = 1;
  long long sum = 0;
  long long add = 0;
  for (int len = 1;; ++len) {
    if (pw * 10 - 1 < r) {
      long long cnt = pw * 10 - pw;
      sum += cnt * len;
    } else {
      long long cnt = r - pw + 1;
      sum += cnt * len;
      break;
    }
    pw *= 10;
  }
  return sum;
}
class BDigitsSequenceHardEdition {
 public:
  void solve(istream& cin, ostream& cout) {
    long long k;
    cin >> k;
    --k;
    long long l = 1, r = (long long)1e12;
    long long res = -1;
    while (r - l >= 0) {
      long long mid = (l + r) >> 1;
      if (sumSoFar(mid) > k) {
        res = mid;
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    cout << to_string(res)[k - sumSoFar(res - 1)] << '\n';
  }
};
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  BDigitsSequenceHardEdition solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
