50180. Matrix Multiplication

I'm a slow walker, but I never walk backwards.

Given two $n$ by $n$ square matrices $A$ and $B$, write a program to compute the matrix $C = AB$.

Every row of $A$, $B$, and $C$ will be stored sequentially in one file. All file names for a matrix have the same prefix, and end with its row index start from $1$ to $n$. For example, if the prefix for $A$ is sample1A, then the first row of $A$ will be stored in a file sample1A1. All elements in $A$ and $B$ are int32_t, and the elements of $C$ are int64_t. You should compute $C$ and store it in files.

Input Format (stdin)

The first line is the size of the matrices, $n$. The second to the fourth lines are the filename prefix for $A$, $B$ and $C$ respectively. The length of all prefixes are less than 20.

• $n \leq 30$

Output Format

You should write $C$ into files in the same file name convention as $A$ and $B$, but with type int64_t.

Sample Input 1

stdin

3sample1Asample1Bsample1C


input files

sample1A1sample1A2sample1A3sample1B1sample1B2sample1B3


output files

sample1C1sample1C2sample1C3


Sample Input 2

stdin

3sample2Asample2Bsample2C


input files

sample2A1sample2A2sample2A3sample2B1sample2B2sample2B3


output files

sample2C1sample2C2sample2C3