#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, a, b, c, d, t, input;
  vector<int> vi;
  for (i = 1; i <= 370; i++) {
    t = i;
    if (t <= 9) {
      vi.push_back(t);
    } else if (t >= 10 && t < 100) {
      a = t % 10;
      t = t / 10;
      b = t;
      vi.push_back(b);
      vi.push_back(a);
    } else if (t >= 100 && t < 1000) {
      c = t % 10;
      t = t / 10;
      b = t % 10;
      t = t / 10;
      a = t;
      vi.push_back(a);
      vi.push_back(b);
      vi.push_back(c);
    } else if (t >= 1000) {
      d = t % 10;
      t /= 10;
      c = t % 10;
      t /= 10;
      b = t % 10;
      t /= 10;
      a = t % 10;
      vi.push_back(a);
      vi.push_back(b);
      vi.push_back(c);
      vi.push_back(d);
    }
  }
  while (cin >> input) {
    cout << vi[input - 1] << endl;
  }
  return 0;
}
