#include <bits/stdc++.h>
using namespace std;
int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int main() {
  int N;
  cin >> N;
  int i = 1;
  string flex("");
  while (flex.length() < N + 1) {
    flex += to_string(i);
    i++;
  }
  cout << flex[N - 1] << endl;
  return 0;
}
