Blind Gauss

시간 제한1초메모리 제한2048 MB

문제

Construct a square matrix with $n$ rows and $n$ columns consisting of nonnegative integers from $0$ to $10^{18}$ such that its determinant is equal to $1$ and there are exactly $a_i$ odd numbers in the $i$-th row for each $i$ from $1$ to $n$, or report that there is no such matrix.

입력

The first line contains a single integer $n$ ($2 \le n \le 50$).

Each of the next $n$ lines contains a single integer $a_i$ ($1 \leq a_i \leq n$).

출력

If there is no matrix that meets the requirements, output -1.

Otherwise, output $n$ lines with $n$ numbers $m_{i,j}$ in each ($0 \leq m_{i,j} \leq 10^{18}$): the elements of the constructed matrix. If there are multiple solutions, print any one of them.