#include #define ff first #define ss second #define pb push_back typedef long long ll; using namespace std; typedef pair pii; const int mod=998244353; inline int add(int x,int y){int ret=x+y;if(ret>=mod)ret-=mod;return ret;} inline int sub(int x,int y){int ret=x-y;if(ret<0)ret+=mod;return ret;} inline int mul(int x,int y){return ((ll)x*y)%mod;} inline int step(int base,int pw){int ret=1;while(pw){if(pw&1)ret=mul(ret,base);base=mul(base,base);pw>>=1;}return ret;} inline int invv(int x){return step(x,mod-2);} inline char gc() { // like getchar() static char buf[1 << 16]; static size_t bc, be; if (bc >= be) { buf[0] = 0, bc = 0; be = fread(buf, 1, sizeof(buf), stdin); } return buf[bc++]; // returns 0 on EOF } int readInt() { int a, c; while ((a = gc()) < 40); if (a == '-') return -readInt(); while ((c = gc()) >= 48) a = a * 10 + c - 480; return a - 48; } const int maxn=1e5+10; ll inf=1e18; struct edge{ int u,v; ll f,c; }; vectore; vectorvect[maxn]; int n,m,start[maxn],level[maxn],pos[maxn]; int sink,source; void add_edge(int u,int v,ll c){ ///printf("%d %d | %lld AA\n",u,v,c); vect[u].pb(e.size()); e.pb({u,v,0,c}); vect[v].pb(e.size()); e.pb({v,u,c,c}); } int bfs(){ memset(level,0,sizeof(level)); queueq; level[source]=1; q.push(source); while(q.size()){ int x=q.front(); q.pop(); for(int i=0;i&rez){ if(u>source && urez; for(edge p:e){ int u=p.u; int v=p.v; ll ff=p.f; ll cc=p.c; if(level[u]>0 && level[v]==0){ dodaj(u,rez); dodaj(v,rez); } } for(int i=0;i