#pragma GCC optimize ("O2")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char cn[1200010];
char* ci = cn, * di = cn, ct;
char tc[200002], *d1 = tc + 100000, *d2 = tc + 200000;
const char d[2] = "0";

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	rep(i, 100000) tc[i] = '0';
	rep(i, 100000) d1[i] = '1';
	d2[0] = '0';
	d2[1] = '\n';
	fread(cn, 1, 1200010, stdin);
	int T = 0;
	while ((ct = *ci++) >= '0') T = T * 10 + ct - '0';

	rep(t, T) {
		int N = 0;
		while ((ct = *ci++) >= '0') N = N * 10 + ct - '0';
		memcpy(di, d1 - N, N);
		di += N;
		memcpy(di, d2 - N, N + 2);
		di += N + 2;
		ci += 6 * N + 3;
	}
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define ri register int
typedef long long ll;
const int maxn=3010,mod=1e9+7;
inline bool ckmin(int &x,const int &y){return x>y?x=y,1:0;}
inline bool ckmax(int &x,const int &y){return x<y?x=y,1:0;}
struct modint{
	int val;
	inline modint(int val_=0):val(val_){}
	inline modint &operator=(int val_){return val=val_,*this;}
	inline modint &operator+=(const modint &k){return val=val+k.val>=mod?val+k.val-mod:val+k.val,*this;}
	inline modint &operator-=(const modint &k){return val=val-k.val<0?val-k.val+mod:val-k.val,*this;}
    inline modint &operator*=(const modint &k){return val=1ll*val*k.val%mod,*this;}
    inline modint &operator^=(int k){
        modint ret=1,tmp=*this;
        for(;k;k>>=1,tmp*=tmp)if(k&1)ret*=tmp;
        return val=ret.val,*this;
    }
    inline modint &operator/=(modint k){return *this*=(k^=mod-2);}
    inline modint &operator+=(int k){return val=val+k>=mod?val+k-mod:val+k,*this;}
    inline modint &operator-=(int k){return val=val<k?val-k+mod:val-k,*this;}
    inline modint &operator*=(int k){return val=1ll*val*k%mod,*this;}
    inline modint &operator/=(int k){return *this*=((modint(k))^=mod-2);}
    template<class T>friend modint operator+(modint a,T b){return a+=b;}
    template<class T>friend modint operator-(modint a,T b){return a-=b;}
    template<class T>friend modint operator*(modint a,T b){return a*=b;}
    template<class T>friend modint operator/(modint a,T b){return a/=b;}
    friend modint operator^(modint a,int b){return a^=b;}
    friend bool operator==(modint a,int b){return a.val==b;}
    friend bool operator!=(modint a,int b){return a.val!=b;}
    inline bool operator!(){return !val;}
    inline modint operator-(){return val?mod-val:0;}
    inline modint &operator++(int){return *this+=1;}
};
using mi=modint;
mi ans[maxn][maxn],sum[maxn][maxn];
int n;
ll a[maxn][maxn];
int main(){
	scanf("%d",&n);
	for(ri i=1;i<=n;++i){
		ll x;
		scanf("%lld",&x);
		for(ri j=1;j<=n;++j)a[i][j]=(a[i-1][j]+x)%j;
	}
	for(ri i=1;i<=n;++i)sum[i][a[n][i]]=1;
	for(ri i=n-1;i;--i){
		for(ri j=1;j<n;++j){
			sum[j][a[i][j]]+=sum[j+1][a[i][j+1]];
		}
	}
	printf("%d",sum[1][0]);
	return 0;
}