mod = 1000000007 n=int(input()) ans = [0]*(n) ans[0] = 1 ans[1] = 3 for i in range(2 ,n): ans[i] = (pow(3, i)-ans[i-1])%mod print(ans[-1])