// yukicoder: No.533 Mysterious Stairs // 2019.7.26 bal4u #include #define MOD 1000000007 unsigned dp[1000005][4]; int main() { int i, j, k, N; unsigned ans; scanf("%d", &N); dp[0][1] = 1, dp[1][1] = 1, dp[2][2] = 1; dp[3][1] = dp[3][2] = dp[3][3] = 1; for (i = 4; i <= N; i++) { for (j = 1; j <= 3; j++) for (k = 1; k <= 3; k++) if (k != j) { dp[i][j] += dp[i-j][k]; } for (j = 1; j <= 3; j++) dp[i][j] %= MOD; } ans = 0; for (j = 1; j <= 3; j++) ans += dp[N][j]; printf("%d\n", (int)(ans % MOD)); return 0; }