#include #include #include using namespace std; int mod = 1000000007; int n; int ans[1000006]; int main() { cin >> n; ans[0] = 0; ans[1] = 1; ans[2] = 2; for (int i = 3; i <= n; i++) { ans[i] = (((ans[i - 1] + ans[i - 2]) % mod) + ans[i - 3]) % mod; } cout << ans[n] << endl; return 0; }