func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> p(n, 0);     for (int i = 0; i < n; i++) {       int aux;       cin >> aux;       p[i] = aux - 1;     }     vector<long long int> dp(n + 1, 0);     for (int i = 1; i < n + 1; i++) {       dp[i] = (long long int)(dp[i - 1] * (long long int)2 - dp[p[i - 1]] + 2 +                               1000000007) %               1000000007;     }     cout << dp[n] << endl;     return 0;   }   