MATRIX MULTIPLICATION CALCULATOR
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Matrix multiplication is a basic tool of linear algebra, and has numerous applications in many areas of mathematics, as well as in applied mathematics, computer graphics, physics, and engineering.

We can only multiply two matrices if their dimensions are compatible, which means the number of columns in the first matrix is the same as the number of rows in the second matrix.

if is an matrix and is an matrix. the product AB is an matrix. The product AB is defined to be the matrix such that



Your task is to design a matrix multiplication calculator to multiply two matrices and display the
output. If the matrices cannot be multiplied, display ""

输入描述:

The input consists of a few test cases. For each test case, the first line of input is 4 positive integers,  and  and N represent the dimension of matrix A, while P and Q represent the dimension of matrix  The following M lines consist of the data for matrix A followed by P lines that contains the data for matrix B as shown in the sample input. The test data ends when  and Q are 

输出描述:

For each test case, the output contains a line in the format "Case #x:", where $x$ is the case number (starting from $1$). The following line(s) is the output of the matrix multiplication.
示例1

输入

复制
2 3 3 2
1 2 3
3 2 1
4 5
6 7
8 9
2 3 2 3
1 2 3
3 2 1
4 5 6
7 8 9
0 0 0 0

输出

复制
Case #1:
| 40 46 |
| 32 38 |
Case #2:
undefined