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;
long long int big_mod(long long int val, long long int pow, long long int mod);
long long int mod_inverse(long long int val, long long int mod);
string sum_of_two_strings(string a, string b);
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int n;
  cin >> n;
  if (n < 10) {
    cout << n;
    return 0;
  }
  long long int i = 2, x = 9, y = 9, pre = 9;
  for (i = 2;; i++) {
    if (n <= pre + x * 10 * i) {
      break;
    }
    x *= 10;
    y *= 10;
    y += 9;
    pre += (x * i);
  }
  if ((n - pre) % i == 0) {
    y += ((n - pre) / i);
  } else {
    y += ((n - pre) / i) + 1;
  }
  pre += (((n - pre) / i) * i);
  vector<int> v;
  v.clear();
  while (y > 0) {
    v.push_back(y % 10);
    y /= 10;
  }
  reverse(v.begin(), v.end());
  if (n == pre) {
    cout << v[v.size() - 1];
  } else
    cout << v[n - pre - 1];
  return 0;
}
long long int big_mod(long long int val, long long int pow, long long int mod) {
  long long int res = 1;
  val = val % mod;
  while (pow > 0) {
    if (pow & 1) {
      res = (res * val) % mod;
    }
    pow = pow >> 1;
    val = (val * val) % mod;
  }
  return res;
}
long long int mod_inverse(long long int val, long long int mod) {
  long long int mod1 = mod;
  if (mod == 1) {
    return 0;
  }
  long long int y = 0;
  long long int x = 1;
  long long int quotient, temp;
  while (val > 1) {
    quotient = val / mod;
    temp = mod;
    mod = val % mod;
    val = temp;
    temp = y;
    y = x - quotient * y;
    x = temp;
  }
  if (x < 0) {
    x += mod1;
  }
  return x;
}
string sum_of_two_strings(string a, string b) {
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  char c;
  string ans = "";
  int length_of_a = a.size(), length_of_b = b.size();
  int i, carry = 0, sum, length = max(length_of_a, length_of_b);
  for (i = 0; i < length; i++) {
    if (i >= length_of_a) {
      sum = (b[i] - 48) + carry;
    } else if (i >= length_of_b) {
      sum = (a[i] - 48) + carry;
    } else {
      sum = (a[i] - 48) + (b[i] - 48) + carry;
    }
    carry = sum / 10;
    sum %= 10;
    c = sum + 48;
    ans += c;
  }
  if (carry > 0) {
    ans += (carry + 48);
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
