n = int(input())
if n == 1:
    print(0)
else:
    pow1 = pow(2,n-1,1000000007)
    print((3*pow1-5)%1000000007)