#include <iostream>
            
using namespace std;
            
int main() {
    int n;
    cin >> n;
    int tmp;
    int dp[n+1];
    dp[0] = 0;
    dp[1] = 1;
    dp[2] = 2;
    dp[3] = 3;
    if (n == 1) {
        cout << 1;
        return 0;
    }
    else if (n == 2) {
        cout << 2;
        return 0;
    }
    else if (n == 3) {
        cout << 3;
        return 0;
    }
    for (int j  = 4;j <= n;j++) {
        dp[j] = (dp[j-1]+dp[j-2])%10007;
    }
    cout << dp[n]  << " ";
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: