D = int(input().strip()) a = '' cnt = 1 while True: a += str(cnt) if len(a) > D - 1: break cnt += 1 print(a[D - 1])