#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k;
  cin >> k;
  bool flag = true;
  for (long long rank = 1, p = 1; flag; ++rank, p *= 10) {
    if (k > rank * (p * 10 - p))
      k -= rank * (p * 10 - p);
    else {
      flag = false;
      long long f = k / rank;
      if (k % rank == 0) --f;
      long long n = p + f;
      k -= rank * f;
      long long h = 0;
      while (rank - h != k) {
        ++h;
        n /= 10;
      }
      cout << n % 10;
    }
  }
  return 0;
}
