The first line contains two integers n and q, number of soldiers of value n, the number of restrictions of
value q.
The next line contains n integers, the ith integer being wi.
The next q row, five integers in each row x, y, v0, v1, v2, represents a restriction.
1 ≤ n ≤ 1e3, 0 ≤ q ≤ 2e3, 2 ≤ wi, v0,v1,v2 ≤ 7e4, wi,v0,v1,v2 are even.
The data guarantees that there will be only one constraint for any unordered pair of (x,y).
