#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
const long long inf = 1e18;
const long long maxx = 2e3 + 19;
string s;
long long n;
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) s += to_string(i);
  cout << s[n - 1];
  return 0;
}
