#include #include #define N 1000000 #define M 1000000007 using namespace std; int main(void) { static long step1[N]={0}; static long step2[N] = {0}; static long step3[N] = {0}; int n; cin >> n; step1[0] = 1; step2[0] = 0; step3[0] = 0; step1[1] = 0; step2[1] = 1; step3[1] = 0; step1[2] = 1; step2[2] = 1; step3[2] = 1; for(int i = 3; i < n; i++) { step1[i] = (step2[i-1] + step3[i-1])%M; step2[i] = (step1[i-2] + step3[i-2])%M; step3[i] = (step1[i-3] + step2[i-3])%M; } cout << ((step1[n-1] + step2[n-1] + step3[n-1])%M) << endl; return 0; }