# import math n=int(input()) if n==1: print(0) else: # nl=int(math.pow(2,n-1)-1) print((3*(2**(n-1)-1)-2)%((10**9)+7))