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;
using LL = long long;
using LLL = __int128;
class IO {
  static const int MAXSIZE = 1 << 20;
  char buf[MAXSIZE], *p1, *p2;
  char pbuf[MAXSIZE], *pp;
  int precision;

 public:
  IO() : p1(buf), p2(buf), pp(pbuf), precision(6) {}
  ~IO() { fwrite(pbuf, 1, pp - pbuf, stdout); }
  inline bool blank(char ch) const {
    return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
  }
  void flush() { fwrite(pbuf, 1, pp - pbuf, stdout), pp = pbuf; }
  void filein(const char* str) const { freopen(str, "rb", stdin); }
  void fileout(const char* str) const { freopen(str, "wb", stdout); }
  inline int getch() {
    if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin);
    return p1 == p2 ? -1 : *p1++;
  }
  template <typename T, typename... Args>
  void read(T& x, Args&... args) {
    read(x);
    read(args...);
  }
  void read() {}
  template <typename T>
  void read(T& x) {
    double tmp = 1;
    bool sign = 0;
    x = 0;
    int ch = getch();
    for (; !(ch >= '0' && ch <= '9') && ~ch; ch = getch())
      if (ch == '-') sign = 1;
    for (; (ch >= '0' && ch <= '9'); ch = getch()) x = x * 10 + (ch - '0');
    if (ch == '.')
      for (ch = getch(); (ch >= '0' && ch <= '9'); ch = getch())
        tmp /= 10.0, x += tmp * (ch - '0');
    if (sign) x = -x;
  }
  void read(char& ch) {
    for (ch = getch(); blank(ch) && ~ch; ch = getch())
      ;
  }
  void read(char* s) {
    int ch = getch();
    while (blank(ch)) ch = getch();
    while (!blank(ch) && ~ch) *s++ = ch, ch = getch();
    *s = 0;
  }
  void readline(char* s) {
    int ch = getch();
    while (blank(ch) && ch != '\n') ch = getch();
    while (ch != '\n' && ~ch) *s++ = ch, ch = getch();
    *s = 0;
  }
  void putch(const char c) {
    if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
    *pp++ = c;
  }
  void setprecision(int n) { precision = n; }
  template <typename T, typename... Args>
  void write(const T& x, const Args&... args) {
    write(x);
    write(args...);
  }
  void write() {}
  template <typename T>
  void write(T x) {
    if (x < 0) x = -x, putch('-');
    static T sta[40];
    int top = 0;
    do sta[top++] = x % 10, x /= 10;
    while (x);
    while (top) putch(sta[--top] + '0');
  }
  void write(char c) { putch(c); }
  void write(double x) {
    const double eps = pow(10, -precision - 2);
    if (x == 0) {
      putch('0'), putch('.');
      for (int i = 1; i <= precision; ++i) putch('0');
      return;
    }
    if (x < 0) putch('-'), x = -x;
    LLL n = pow(10, precision);
    double res = (LLL)(x * n + 0.5) / (n * 1.0);
    LLL y = LLL(res * n + eps) % n;
    if (precision) {
      write(LLL(res + eps), '.');
      int sta[20], p = 0;
      for (; p < precision; y /= 10) sta[++p] = y % 10;
      for (int i = p; i >= 1; i--) putch(sta[i] ^ 48);
    } else
      write(LLL(res + eps));
  }
  void write(const char* s) {
    while (*s) putch(*s++);
  }
} io;
int main() {
  LL n;
  io.read(n);
  LL cur = 1, cnt = 9;
  while (cur * cnt < n) {
    n -= cur * cnt;
    cnt *= 10;
    ++cur;
  }
  LL t = n % cur;
  if (!t) t = cur;
  LL ans = 1;
  for (int i = 1; i < cur; i++) ans *= 10;
  ans += (n - 1) / cur;
  for (int i = 1; i <= cur - t; i++) ans /= 10;
  io.write(ans % 10), io.putch('\n');
  return 0;
}
