import sequtils template times*(n:int,body) = (for _ in 0.." .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': return result = 10 * result + k.ord - '0'.ord let w = scan() let n = scan() let J = newSeqWith(n,scan()) let m = scan() let C = newSeqWith(m,scan()) var f = initFlow(n+m+2) # J:0.. n+m+1 let src = n + m let dst = n + m + 1 for i,j in J: f.add(src,i,j) for i,c in C: f.add(n+i,dst,c) for c in n..