#include <bits/stdc++.h>
using namespace std;
namespace patch {
template <typename T>
std::string to_string(const T& n) {
  std::ostringstream stm;
  stm << n;
  return stm.str();
}
}  // namespace patch
char getInt(int pos) {
  string ss = "";
  for (int i = 1; i <= pos; i++) ss += patch::to_string(i);
  return ss.at(pos - 1);
}
int main() {
  int n;
  cin >> n;
  cout << getInt(n);
}
