n = int(input()) mod = 10**9+7 tmp = pow(6,n,mod) bo = pow(tmp,mod-2,mod) #print(tmp) shi = pow(7,n-1,mod) ans = (bo*shi)%mod print(ans%mod)