ll n;mint a[2d5],b[2d5],s,t;{rd(n,a(n+1),b(n+1));t+=s*a[s+=b[0..n],n-(0..)];wt(t);}