#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a = "1";
  for (int i = 2; a.size() <= n; i++) {
    string t;
    int x = i;
    while (x >= 10) {
      string f = t;
      t = x % 10 + '0';
      t = t + f;
      x = x / 10;
    }
    string f = t;
    t = x % 10 + '0';
    t = t + f;
    a = a + t;
  }
  cout << a[n - 1];
  return 0;
}
