#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, j, k, l, x, y, z, t;
  cin >> k;
  string s;
  x = 0, i = 1;
  while (x <= k) {
    string str = to_string(i);
    s += str;
    i++;
    x = s.size();
  }
  cout << s[k - 1] << endl;
}
