cho.sh
Notes
Loading...

Completing a Magic Square

Time limit

2s

Memory limit

128 MB

Problem

A 3 by 3 magic square is a square grid in which every row, every column, and both diagonals have the same sum.

Dongju and Sejun accidentally erased up to three cells from a magic square. Erased cells are shown as 0 in the input. Complete the magic square using the remaining numbers.

Every number in the completed magic square is a positive integer not greater than 20,000.

Input

The three rows of the magic square are given from the first line to the third line. Each line contains three integers separated by spaces. An erased cell is given as 0. At most three cells are erased.

Output

Print the completed magic square in the same three-line format as the input.