N=int(input()) A=[0]+list(map(int,input().split())) C=[[0]*i for i in range(1001)] DP=[0]*(N+2) mod=10**9+7 DP[1]=1 for i in range(1,N+1): for j in range(1,1001): DP[i]+=C[j][i%j] if DP[i]>=mod: DP[i]-=mod if A[i]<=1000: m=i%A[i] C[A[i]][m]+=DP[i] if C[A[i]][m]>=mod: C[A[i]][m]-=mod else: for j in range(i+A[i],N+1,A[i]): DP[j]+=DP[i] if DP[j]>=mod: DP[j]-=mod if A[i]>1: DP[i+1]+=DP[i] if DP[i+1]>=mod: DP[i+1]-=mod print(DP[N])