#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define loop(i,a,b) for(int i=a;i pii; typedef vector vi; typedef vector vvi; typedef vector vp; typedef vector vvp; typedef vector vs; typedef vector vd; typedef vector vvd; typedef pair pip; typedef vectorvip; const double PI=acos(-1); const double EPS=1e-7; const int inf=1e8; const ll INF=1e16; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; #define MOD 1000000007 // a^b mod MOD ll powmod(ll a,ll b){ ll out=1; ll p=a%MOD; while(b){ if(b&1)out=out*p%MOD; p=p*p%MOD; b>>=1; } return out; } #define M 10000 vector fact; void init(){ fact=vector(M); fact[0]=fact[1]=1; loop(i,2,M)fact[i]=fact[i-1]*i%MOD; } // nCr ll nCr(ll n,ll r){ if(n>n>>k>>d; ll out=0,s=int((double)(n-1)/(k-1)),t=n-s*(k-1); if(d==1){ cout<