func_code_string: #include <bits/stdc++.h>   using namespace std;   long long power(long long a, long long p, long long mod) {     long long ret = 1;     while (p) {       if (p & 1) ret = (ret * a) % mod;       a = (a * a) % mod;       p /= 2;     }     return ret;   }   long long DP[1000];   int A[1000];   int main() {     int n;     cin >> n;     for (__typeof((__typeof(n))0) i((__typeof(n))0); i < n; i++) {       cin >> A[i];       A[i]--;     }     for (int i = 0; i < n; i++) {       DP[i] = 2;       for (int j = A[i]; j < i; j++) DP[i] = (DP[i] + DP[j]) % 1000000007;     }     long long ans = 0;     for (int i = 0; i < n; i++) ans = (ans + DP[i]) % 1000000007;     cout << ans << endl;     return 0;   }   