Our company sells various products and we need to sum both the cost involved as well as the profit in this market. The input data is defined in two matrices, one indicating the products sold per month and another indicating the cost and profit per unit associated with each product. We need to produce a similar matrix containing the aggregate cost of the products sold, together with the profit. The Figure 1 illustrates a case where we have three different pieces and three months, with its result.
The input have many test cases. Initially, a N value is informed, indicating the quantity of test cases to be processed. Each test case starts with two integers P (0< P<=20) and M (0<M<=12) indicating, respectively, the quantity of sold products and the months to be considered. Next, two matrices must be read, the first containing M rows with P integers Q (0<=Q<=100), separated by a single white space, indicating the sold products sold in each month and the second containing P rows with two integers C and L (0<=C, L <=25) in each row, indicating respectively the cost and profit by unit of each product.
For each test case, print the number of the test case, as shown in the examples, followed by the matrix containing M rows, each one with two integers, that represents the total cost and profit of each month.
|Exemplos de Entrada||Exemplos de Saída|