import sys sys.setrecursionlimit(1000000000) N = int(input()) dp = [ [i for i in range(3)] for i in range(N+1)] for i in range(N): for j in range(3): dp[i+1][0] += dp[i][2] + dp[i][1] dp[i+1][1] += dp[i][0] + dp[i][2] dp[i+1][2] += dp[i][1] + dp[i][2] # #ans = 0 #or i in range(3): # ans += dp[N][i] #print(ans) memo1 = [ -1 for i in range(N+1)] memo2 = [ -1 for i in range(N+1)] memo3 = [ -1 for i in range(N+1)] MOD = 10**9 + 7 def r1(n): if n == 1: return 1 elif n == 2: return 0 elif n == 3: return 1 else: if memo2[n-1] == -1: memo2[n-1] = r2(n-1) % MOD if memo3[n-1] == -1: memo3[n-1] = r3(n-1)%MOD return (memo2[n-1] + memo3[n-1]) % MOD def r2(n): if n == 1: return 0 elif n == 2: return 1 elif n == 3: return 1 else: if memo1[n-2] == -1: memo1[n-2] = r1(n-2) % MOD if memo3[n-2] == -1: memo3[n-2] = r3(n-2) % MOD return (memo1[n-2] + memo3[n-2]) % MOD def r3(n): if n == 1: return 0 elif n == 2: return 0 elif n == 3: return 1 else: if memo1[n-3] == -1: memo1[n-3] = r1(n-3) % MOD if memo2[n-3] == -1: memo2[n-3] = r2(n-3) % MOD return (memo1[n-3] + memo2[n-3]) % MOD def r(n): return (r1(n) + r2(n) + r3(n)) % MOD for i in range(4,N): r(i) print(r(N))