You are given an arrayof length , consisting of positive integers, and an array of length , also consisting of positive integers.
There are Note that ( ) is a positive integer not exceeding 30.modification. On the -th modification ( ), for each ( ), such that is divisible by , you add to .
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 integersand ( ) —the length of the array and the number of queries respectively.
The second line of each test case containsintegers — the elements of the array ( ).
The third line of each test case containsintegers — the elements of the array ( ), which are the modification queries.
It is guaranteed that the sum ofand the sum of across all test cases does not exceed .
For each test case, output the array after all of the modification queries.
1 2 3 6 6 7 10 14 38 58 6 3 3 3 3 3 3 1 3 7 11 19
In the first test case, the first query will addto 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 addto 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: .