#include <bits/stdc++.h>
int main() {
  int32_t n;
  std::cin >> n;
  std::string str = "";
  int32_t cur = 1;
  while (str.size() < n) {
    str += std::to_string(cur);
    cur++;
  }
  std::cout << str[n - 1] << std::endl;
}
