#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  string s = "";
  for (int i = 1; i <= k; i++) {
    stringstream ss;
    ss << i;
    s = s + ss.str();
  }
  cout << s[k - 1] << endl;
  return 0;
}
