Matrix multiplication#1482

Matrix multiplication

1 second
128 megabytes
Very easy

Let two rectangular matrices A and B with dimensions m × n and n × q respectively be given:

prb1482-1

Then the matrix C of dimensions m × q is called their product:

prb1482-2

where:

prb1482-3

Multiplication of two matrices is possible only if the number of columns in the first matrix equals the number of rows in the second; in this case, the matrices are said to be conformable.

Two matrices A and B are given. Find their product.

Input

The first line contains two positive integers n_a and m_a — the dimensions of matrix A. Each of the next n_a rows contains m_a integers — the elements a_{ij} of matrix A. The (n_a + 2)-nd line contains two positive integers n_b and m_b — the dimensions of matrix B. The next n_b lines each contain m_b integers — the elements b_{ij} of matrix B. Matrix dimensions do not exceed 100 \times 100, and all matrix elements are integers with absolute value at most .

Output

Print the dimensions of the resulting matrix C: n_c and m_c in the first line. In each of the next n_c lines, print m_c integers separated by spaces — the corresponding elements c_{ij} of matrix C. If matrix multiplication is not possible, print -1 in the first and only line.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading