Matrix Inverse

Given a square $n\times n$ matrix $A$, the definition of its inverse $B=A^{-1}$ is the matrix that fulfills the equality:

\[ AB = I \]where $B$ and $I$ are $n\times n$ matrices, and $I$ is the identity matrix with ones along the diagonal, and zeros everywhere else:

\[ I = \left[ \begin{matrix} 1 & 0 & \ldots & 0 \\ 0 & 1 & \ldots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \ldots & 1 \end{matrix} \right] \]For this problem, you should implement a matrix inverse solver for $2\times 2$ matrices.

Each test case is described by two lines of input. Each line has two 32-bit signed integers, and the integers given in order $a$, $b$, $c$, $d$ represent the values of the matrix to invert:

\[ A = \left[ \begin{array}{cc} a & b \\ c & d \end{array} \right] \]A blank line follows each test case.

For each case, display the case number followed by two lines containing the inverse of the given matrix. Each test case is guaranteed to have an inverse (i.e. no matrix is singular), and that inverse is integer-valued. Follow the format of the sample output.

Sample Input 1 | Sample Output 1 |
---|---|

1 0 0 1 30 29 1 1 -7 -16 4 9 |
Case 1: 1 0 0 1 Case 2: 1 -29 -1 30 Case 3: 9 16 -4 -7 |