#include <bits/stdc++.h>
using namespace std;
int main() {
  std::string text = "";
  long long int n;
  cin >> n;
  for (int i = 0; i <= n; i++) {
    text += std::to_string(i);
  }
  cout << text[n];
  return 0;
}
