#include int dp[3][1000000]; main(){ dp[0][0] = 1; dp[1][1] = 1; dp[2][2] = 1; dp[0][2] = 1; dp[1][2] = 1; for(int i = 3;i < 1000000;i++){ dp[0][i] = (dp[1][i-1] + dp[2][i-1])%1000000007; dp[1][i] = (dp[0][i-2] + dp[2][i-2])%1000000007; dp[2][i] = (dp[0][i-3] + dp[1][i-3])%1000000007; } int N,sum=0; scanf("%d",&N); for(int i = 0;i < 3;i++){ sum = (sum+dp[i][N-1])%1000000007; } printf("%d\n",sum); }