There are multiple test cases. Please process till EOF (end of file).
The 1st line of each test case contains 2 integers N and T. In the 2nd line, there are N space-separated integers A1, A2, … , AN. The next line also contains N space-separated integers B1, B2, … , BN. Then the last line of each test case contains N space-separated integers P1, P2, … , PN.
1<=N, T<=100000.
For all i (1 <= i <= N), 0 <= Ai, Bi < Pi, 5*10^8 < Pi < 10^9.
For simplicity, all Pi are prime.
All Ai, Bi are randomly and uniformly generated between [0, Pi).
The sum of all N will not exceed 1000000.
The number of test cases is smaller than 250. Most test cases are small.
In at least 50% of cases, N will not exceed 100, at least 80% of cases, N will not exceed 1000.