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;
template <class T1, class T2>
void pr(const pair<T1, T2>& x);
template <class T, size_t SZ>
void pr(const array<T, SZ>& x);
template <class T>
void pr(const vector<T>& x);
template <class T>
void pr(const set<T>& x);
template <class T1, class T2>
void pr(const map<T1, T2>& x);
template <class T>
void pr(const T& x) {
  cout << x;
}
template <class Arg, class... Args>
void pr(const Arg& first, const Args&... rest) {
  pr(first);
  pr(rest...);
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x) {
  pr("{", x.first, ", ", x.second, "}");
}
template <class T>
void prContain(const T& x) {
  pr("{");
  bool fst = 1;
  for (auto& a : x) pr(!fst ? ", " : "", a), fst = 0;
  pr("}");
}
template <class T, size_t SZ>
void pr(const array<T, SZ>& x) {
  prContain(x);
}
template <class T>
void pr(const vector<T>& x) {
  prContain(x);
}
template <class T>
void pr(const set<T>& x) {
  prContain(x);
}
template <class T1, class T2>
void pr(const map<T1, T2>& x) {
  prContain(x);
}
void ps() { pr("\n"); }
template <class Arg, class... Args>
void ps(const Arg& first, const Args&... rest) {
  pr(first, " ");
  ps(rest...);
}
template <typename T>
int remin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
int remax(T& a, const T& b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}
long long N;
string s = "";
int solve(long long n) {
  long long p = 9, u = 9, pu = 0;
  long long pi = 0;
  for (int k = 1; k < 19; ++k) {
    if (n <= u) {
      long long i = pi + (n - pu + k - 1) / k;
      return to_string(i)[(n - pu + k - 1) % k] - '0';
    }
    p *= 10;
    pu = u;
    pi = pi * 10 + 9;
    u = pu + p * (k + 1);
  }
  return 0;
}
int main(int argc, const char** argv) {
  scanf("%lld", &N);
  printf("%d\n", solve(N));
  return 0;
}
