#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; bool rcmp(int a, int b) { return a>b; } typedef long long LL; class mypcmp { public: bool operator()(const int& a, const int& b) { return a>=1; } return r; } void fft(int *p, int n, char revert) { if ((MOD-1)%n) assert(0); int rt = expit(GGG, (MOD-1)/n); LL x, y; if (revert) { rt = expit(rt, MOD-2); } int b, i, j, l, t; LL w, ww, v, u, vv; for (i=1, j=0; i>1; for (; j&b; b>>=1) j^=b; j^=b; if (i=MOD) vv-=MOD; p[i+j]=vv; vv=u-v; if (vv<0) vv+=MOD; p[i+j+l/2]=vv; ww*=w; ww%=MOD; } } } if (revert) { x = expit(n, MOD-2); for (i=0; i0&&pbuf1[i]==0) i--; return i; } int ff[300][601*300]; int fc[300]; int as[200004], bs[200004]; int dp[301][301][604]; int main() { int n, i, m, s, e, k, c, d, j, a, b, mc, bb, ms; LL v; memset(dp, 0, sizeof(dp)); // a=0 dp[0][0][300]=1; for (b=1; b<=300; b++) { dp[0][b][300-0]=1; dp[0][b][300-b]=1; for (d=1; d1) { s=0; e=k-1; while(s