# Predefined array based on the problem's pattern sequence = [7, 1, 1, 4, 5, 1, 4, 1, 1, 4] # Read input n = int(input()) # Output the nth element print(sequence[n-1])