#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int result;
  cin >> n;
  int i = 1;
  int count = 0;
  while (true) {
    string s = to_string(i);
    count += s.length();
    if (count < n) {
      i++;
    } else {
      int id = count - n;
      int rid = s.length() - id - 1;
      result = s[rid] - '0';
      break;
    }
  }
  cout << result;
  return 0;
}
