#yuki756 d=int(raw_input()) s='' for i in xrange(56): s+=str(i) print s[d]