#include using namespace std; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n; vector as(n); for(Int i=0;i>as[i]; for(Int i=0;i>q; for(Int i=0;i>k; Int x=0; for(Int j=0;j>j)&1) x+=dp[j][x%n]; cout<