ll n,l,a[1d5],d=1;Mint b=1,c=1;{rd(n,a(n));rep(r,n){for(d*=a[r],b*=Mint(a[r])**(r-l+1);d/1d9;d/=a[l++])b/=d;c*=b;}wt(c);}