Skip to content
UPEEC

Matrix Multiplication

Medium#arrays#matrix#math· solved by 0 · time limit 2.0 s

Multiply an n×mn \times m matrix AA by an m×pm \times p matrix BB. (AB)ij=∑kAikBkj(AB)_{ij} = \sum_k A_{ik} B_{kj}.

Input

nn mm and the rows of AA, then mm pp and the rows of BB.

Output

nn rows of pp integers.

Constraints

1≤n,m,p≤1001 \le n, m, p \le 100, ∣aij∣,∣bij∣≤1000|a_{ij}|, |b_{ij}| \le 1000

Sample 1

Input

2 2
1 2
3 4
2 2
5 6
7 8

Output

19 22
43 50

Sign in or join free to run and submit your solution.