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