ll@n,@m,@w,@a[n],@b[],@c[m],@d[],z=0; vector>v; char u[1<<14]; v.push_back({0,0,0}); while(!v.empty()){ auto x=v.back(); v.pop_back(); if(z=0){ ll j=x[0]|1<