#include #include #include using namespace std; int N; long dp[1000000][4]; long jump(int now, int back_jump){ if(now >= N){ return now == N; }else if(dp[now][back_jump] != -1){ return dp[now][back_jump]; }else{ long ans = 0; for(int i = 1; i <= 3; i++){ if(i != back_jump){ ans += jump(now + i, i); } } return dp[now][back_jump] = ans % long(1e9 + 7); } } int main(){ cin >> N; dp[0][0] = -1; for(int i = 0; i < 1000000; i++){ dp[i][1] = -1; dp[i][2] = -1; dp[i][3] = -1; } cout << jump(0, 0) << endl; }