n = int(input()) print('47890564231'[n])