# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

## Little Matrix Multiplication

Limits: 1s, 512 MB

Given two 2×2 matrices, calculate the product of the two matrices.

The product of two 2×2 matrices will produce another 2×2 matrix where:

```
A = [ A₁₁ A₁₂
A₂₁ A₂₂ ]
```

```
B = [ B₁₁ B₁₂
B₂₁ B₂₂ ]
```

```
C = A × B = [ C₁₁ C₁₂
C₂₁ C₂₂ ]
```

```
C₁₁ = A₁₁ × B₁₁ + A₁₂ × B₂₁
C₁₂ = A₁₁ × B₁₂ + A₁₂ × B₂₂
C₂₁ = A₂₁ × B₁₁ + A₂₂ × B₂₁
C₂₂ = A₂₁ × B₁₂ + A₂₂ × B₂₂
```

For example:

```
A = [ 2 3
4 5 ]
```

```
B = [ 5 6
7 8 ]
```

```
C = A × B = [ 31 36
55 64 ]
```

#### Input

The input contains two matrices as follows:

```
A₁₁ A₁₂
A₂₁ A₂₂
B₁₁ B₁₂
B₂₁ B₂₂
```

The value of each of these 8 integers is non-negative and less than 100.

#### Output

Print the product of the two matrices as follows:

```
C₁₁ C₁₂
C₂₁ C₂₂
```

#### Samples

Input | Output |
---|---|

2 3 4 5 5 6 7 8 | 31 36 55 64 |

YouKnowWho Earliest, 2w ago

YouKnowWho Fastest, 0.0s

YouKnowWho Lightest, 131 kB

mainulislam588 Shortest, 261B

Login to submit