#include <bits/stdc++.h>
using namespace std;
void file_i_o() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int n;
int cnt = 0;
string ToString(int k) {
  string s;
  while (k) {
    int d = k % 10;
    char c = '0' + d;
    s += c;
    k /= 10;
    cnt++;
  }
  reverse(s.begin(), s.end());
  return s;
}
int main() {
  string final;
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) {
    final += ToString(i);
  }
  cout << final[n - 1] << endl;
  return 0;
}
