#include <bits/stdc++.h>
long int nod(long int n) {
  long int i = 0;
  while (n >= 1) {
    i++;
    n = n / 10;
  }
  return i;
}
int main() {
  long int i = 0, k, c = 0;
  scanf("%ld", &k);
  while (c < k) {
    i++;
    c = c + nod(i);
  }
  while (c != k) {
    i = i / 10;
    c--;
  }
  printf("%ld", i % 10);
}
