#include using namespace std; using ll = long long; const ll MOD = 1000000007; const long long INF = 1LL << 60; #define rep(i,n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main() { ll n, ans; cin >> n >> ans; rep(i,n-1){ ll a; cin >> a; ans *= a+1; ans %= MOD; } cout << ans << endl; }