# No.756 チャンパーノウン定数 (1) d = int(input()) champernowne = '0' i = 1 while len(champernowne) <= d + 1: champernowne += str(i) i += 1 print(champernowne[d])