func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007;   int maina() {     int T;     cin >> T;     for (int _t = 0; _t < T; _t++) {     }     return 0;   }   int main() {     ios::sync_with_stdio(false);     long long N;     cin >> N;     vector<long long> in(N);     for (int i = 0; i < N; ++i) {       cin >> in[i];       in[i]--;     }     vector<long long> cnt(N);     cnt[0] = 2;     long long result = 2;     for (int i = 1; i < N; ++i) {       long long total = 2;       for (int j = in[i]; j < i; ++j) {         total += cnt[j];         total %= MOD;       }       cnt[i] = total;       result += total;       result %= MOD;     }     cout << result;     return 0;   }   