# ADA University - January 30

# Matrix multiplication

Given two square matrices **A** and **B** of dimensions **m** × **n** and **n** × **q** respectively:

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

where:

The operation of multiplication of two matrices is feasible only if the number of columns in the first factor equals to the number of rows in the second. In this case we say that the shape of the matrices is consistent.

Given two matrices **A** and **B**. Find their product.

#### Input

The first line contains two positive integers `n`

and _{a}`m`

- the dimensions of matrix _{a}**A**. Each of the next `n`

rows contains _{a}`m`

numbers - the elements _{a}`a`

of matrix _{ij}**A**. In (`n`

+ _{a}**2**)-nd row two positive integers `n`

and _{b}`m`

are given - the dimensions of matrix _{b}**B**. In the following `n`

lines _{b}`m`

numbers are given - the elements _{b}`b`

of matrix _{ij}**B**. Dimensions of the matrices do not exceed **100** × **100,** all integers do not exceed **100** by absolute value.

#### Output

Print in the first line the dimensions of the resulting matrix **C**: `n`

and _{с}`m`

. In the next _{c}`n`

rows print space separated _{с}`m`

numbers - the corresponding elements _{c}`c`

of matrix _{ij}**C**. If you cannot multiply matrixs in the first and only line of output **-1**.

2 3 1 3 4 5 -2 3 3 3 1 3 2 2 1 3 0 -1 1

2 3 7 2 15 1 10 7

2 3 10 12 31 23 11 17 3 4 0 2 1 4 3 9 2 4 -5 4 2 5

2 4 -119 252 96 243 -52 213 79 221