Cute table#1759

Cute table

1 secondo
64 megabyte
Molto facile

Consider a table of size M \times N in which each cell contains a non-negative integer. The table is called nice if, for every , the sum of the numbers in its -th row does not exceed R_i, and for every , the sum of the numbers in its -th column does not exceed C_j.

You are given a table of size M \times N, in which some cells already contain non-negative integers. Find a nice table with the maximal possible sum of elements, such that it coincides with in every cell where contains a number.

Input

The first line contains two integers and (1 \leq M, N \leq 20). The next line contains non-negative integers: R_1, R_2, \ldots, R_M. The next line contains non-negative integers: C_1, C_2, \ldots, C_N. All constraints do not exceed 10^6. The following lines each contain integers and define the table . If a cell does not contain a number, the value in the input file at that position is .

Output

Output the resulting table as rows of integers.

If there is no solution, output a single number: .

Esempi

Esempio 1

Loading
Loading