#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int eps = 1e-6;
const int MAX = 100010;
long long int tosolve[MAX], moves[MAX], n, p[MAX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1, _n = (n + 1); i < _n; ++i) cin >> p[i];
  tosolve[1] = moves[1] = 2;
  for (int i = 2, _n = (n + 1); i < _n; ++i) {
    for (int j = p[i], _n = (i); j < _n; ++j) tosolve[i] += tosolve[j];
    tosolve[i] += 2;
    tosolve[i] %= MOD;
    moves[i] = moves[i - 1] + tosolve[i];
    moves[i] %= MOD;
  }
  cout << moves[n] << endl;
  return 0;
}
