#include using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector vint; typedef pair pint; #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin() , v.end() #define REP(i, x, n) for(int i = x; i < n; i++) int main(){ int d; cin >> d; string s; rep(i, 56){ s += to_string(i); } cout << s[d] << endl; }