User:Doriath~/be bold

Being bold is important on Wikipedia.

Preformatted code: typedef long long ll; int n; int pr[1002]; ll dp[1002]; int main(void) { cin >> n;     for (int i = 0; i < n; ++i) { cin >> pr[i]; --pr[i]; }     ll total = 2; dp[0] = 2; for (int i = 1; i < n; ++i) { dp[i] = 2; for (int j = pr[i]; j < i; ++j) { dp[i] = (dp[i] % MOD + dp[j] % MOD) % MOD; }         total = (total % MOD + dp[i] % MOD) % MOD; }     cout << total % MOD << endl; exit(0); }
 * 1) define MOD 1000000007