n = int(input()) # s = '-7000500000' #1,4,5 s = '-7xxx5xxx0?' print(s[n])