#include <bits/stdc++.h>
using namespace std;
long long a[100], b[100], c[100];
int main(int argc, char const *argv[]) {
  a[1] = 9;
  for (int i = 2; i <= 12; ++i) {
    a[i] = a[i - 1] * 10;
  }
  b[1] = 1;
  c[1] = 1;
  for (int i = 2; i <= 12; ++i) {
    b[i] = b[i - 1] + a[i - 1] * (i - 1);
    c[i] = c[i - 1] * 10;
  }
  long long k;
  cin >> k;
  int p = upper_bound(b + 1, b + 13, k) - b - 1;
  long long num = c[p] + (k - b[p]) / p;
  string str = to_string(num);
  cout << str[(k - b[p]) % p] << endl;
  return 0;
}
