#P1891B. Deja Vu
Deja Vu
Description
You are given an array of length , consisting of positive integers, and an array of length , also consisting of positive integers.
There are modification. On the -th modification (), for each (), such that is divisible by , you add to . Note that () is a positive integer not exceeding 30.
After all modification queries, you need to output the final array.
The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers and () —the length of the array and the number of queries respectively.
The second line of each test case contains integers — the elements of the array ().
The third line of each test case contains integers — the elements of the array (), which are the modification queries.
It is guaranteed that the sum of and the sum of across all test cases does not exceed .
For each test case, output the array after all of the modification queries.
Input
The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers and () —the length of the array and the number of queries respectively.
The second line of each test case contains integers — the elements of the array ().
The third line of each test case contains integers — the elements of the array (), which are the modification queries.
It is guaranteed that the sum of and the sum of across all test cases does not exceed .
Output
For each test case, output the array after all of the modification queries.
Note
In the first test case, the first query will add to the integers in positions and . After this addition, the array would be . Other operations will not modify the array.
In the second test case, the first modification query does not change the array. The second modification query will add to the integer in position , so that the array would look like this: . The third modification query will add to the integers in positions , and . The array would then look like this: .