mod = 10**9+7 n = int(input()) n = "1"+"3"*n nsj = int(n) print(nsj%mod)