n = int(input()) ans = 0 MAX_NUM = 10 ** 9 + 7 if n <= 1: print(0) else: print(int((3 * pow(2, n-1, MAX_NUM) - 5) % MAX_NUM))