An integer T in the first line, it is the number of tesecases. And there are T cases later.
In each case, two integers in the first line n,m, which is the numbers of soldiers in the Pty’s team and the monster’s team.
In the next n lines, each line contains 4 integers. They means the hit point, the increment of hit point every day, the damage and the increment of damage every day.
In the next m lines, also contains 4 integers. They are the information of the soldier in the monster’s team.
$(1 \leq n,m\leq 10^5, \sum (n+m) \leq 2\times 10^6,0 \leq h_x,d_x \leq 10^6,0\leq increment \leq 10^3)$