#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[3000];
  int ert = 0, at = 0, as = 0;
  int k = 1;
  while (k < 3000) {
    ert++;
    if (ert % 10 == 0) at++;
    if (ert % 10 == 0 and at % 10 == 0) as++;
    if (k <= 9) {
      a[k] = ert % 10;
      k++;
    } else {
      if (k > 9 and k < 190) {
        a[k] = at % 10;
        k++;
        a[k] = ert % 10;
        k++;
      } else {
        a[k] = as % 10;
        k++;
        a[k] = at % 10;
        k++;
        a[k] = ert % 10;
        k++;
      }
    }
  }
  cout << a[n];
}
