from math import factorial j = int(input()) if j>2: print(2*(3**(j-2))) else: print(factorial(j))