#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e9;
const long long int MOD = 1e9 + 7;
pair<long long int, long long int> arr[15];
int main() {
  long long int k, i, c = 1;
  cin >> k;
  if (k >= 1 && k <= 9) {
    cout << k << "\n";
    return 0;
  }
  long long int val = 9;
  arr[0].first = 0;
  arr[0].second = 0;
  for (i = 1; i <= 13; i++) {
    arr[i].first = arr[i - 1].second + 1;
    arr[i].second = arr[i].first + i * val - 1;
    val *= 10;
  }
  for (i = 1; i <= 13; i++) {
    if (k >= arr[i].first && k <= arr[i].second) break;
    c = c * 10;
  }
  k = k - arr[i].first;
  char ch = (to_string(c + k / i))[k % i];
  cout << ch << "\n";
}
