M = int(input()) c = 2 for _ in range(7): c = c * c % M print(c)