n = int(input()) # s = '-7xxx5xxxx0' # 1,4,5 # s = '-7xxx5xx2?0' # 1,4,5,8 # s = '-7xxx5xx230' # 1,4,5,8,9 # s = '-7xx45xx230' # 1,4,5,7,8,9 # s = '-7xx4566230' # s = '-7884566230' # s = '-7894566230' s = '-7894561230' print(s[n])