func_code_string: #include <bits/stdc++.h>   using namespace std;   int N, P[1005], D[1005];   int main() {     scanf( %d , &N);     for (int i = 1; i <= N; i++) {       scanf( %d , &P[i]);     }     D[1] = 1;     for (int i = 2; i <= N; i++) {       int p = P[i];       D[i] = 1;       for (int j = p; j < i; j++) {         D[i] += D[j] + 1;         D[i] %= 1000000007;       }     }     int res = 0;     for (int i = 1; i <= N; i++) {       res += D[i] + 1;       res %= 1000000007;     }     printf( %d n , res);     return 0;   }   