from sys import stdin def main(): D = int(input()) num = ''.join([str(i) for i in range(56)]) print(num[D]) input = lambda: stdin.readline() main()