#define _USE_MATH_DEFINES #include #include #include #include #include #include #include using namespace std; /* sample input */ long long n; long long dp[1000001][3]; int main() { cin >> n; long long a = 1000000000 + 7; dp[1][0] = 1; dp[1][1] = 0; dp[1][2] = 0; dp[2][0] = 0; dp[2][1] = 1; dp[2][2] = 0; dp[3][0] = 1; dp[3][1] = 1; dp[3][2] = 1; for (int i = 4; i <= n; i++){ dp[i][0] = dp[i - 1][1] + dp[i - 1][2]%a; dp[i][1] = dp[i - 2][0] + dp[i - 2][2]%a; dp[i][2] = dp[i - 3][0] + dp[i - 3][1]%a; } long long answer = (dp[n][0] + dp[n][1] + dp[n][2]) % a; cout << answer << endl; return 0; }