int N,A[1d5]; mint dp[1d5],C[101][100],m[101]={}; { rd(N,A(N)); dp[0]=1; rep(i,N){ rep(d,1,100) dp[i]+=C[d][m[d]]; if(i==N-1) break; if(A[i]==1) C[1][0]+=dp[i]; else if(A[i]<=100) dp[i+1]+=dp[i], C[A[i]][m[A[i]]]+=dp[i]; else{ dp[i+1]+=dp[i]; rep(j,i+A[i],N,A[i]) dp[j]+=dp[i]; } rep(d,1,100) m[d]+=1, if(m[d]==d) m[d]=0; } wt(dp[N-1]); }