#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a; using mat = vector; void gauss(mat &v){ int n=v.size(); for(Int i=0;i=m) break; swap(v[i],v[s]); for(int j=0;j > tmp(n,vector(n,0)); mat res(n,BS(0)); for(int i=0;i>=1; } return res; } //INSERT ABOVE HERE signed main(){ int n; cin>>n; vector d(n),w(n); for(int i=0;i>d[i]; for(int i=0;i>w[i]; mat A(n); for(int i=0;i