Олимпиадный тренинг

Задача 38247. The task of the Zen master


Задача

Темы: Цикл for
After many years of meditation, one Zen monk realized that he was not really enlightened yet. Coming to the master, he asked how to achieve enlightenment. The master answered him, "Even the masters do not know this." When the monk questioned him in bewilderment, the master told him that there are people who seem enlightened, but in fact are stupid and do not understand anything about Zen. As an illustration of his words, he offered him the following problem.

A person can be represented as a table of size N × M filled with some integers. The sum of the numbers in the row of the table symbolizes how people see a person (the larger the sum, the more enlightened a person is considered in this area of ​​Zen). The sum of the numbers in the column symbolizes the person's real knowledge (the smaller it is, the less the person knows, and if the sum of the numbers is negative, then the person's ideas are false). It is necessary to fill the table with any integers so that the sum of the numbers in each row of the table is positive (that is, the person externally seemed to be absolutely enlightened), and the sum of the numbers in as many columns as possible was negative (that is, the person’s ideas about Zen were actually mostly false).

Help the Zen monk get closer to enlightenment and solve the problem proposed by the master.

Input
Enter the numbers N (1 ≤ N ≤ 100) and M (1 ≤ M ≤ 100) — the number of rows and columns in the table. Numbers are separated by spaces.

Imprint
First, print the maximum number of columns for the given table sizes, the sum of numbers in which is negative, and then print the table itself, filled accordingly. If there are several ways to fill in the table, print any of them. The numbers in the answer must not exceed 1000.
Examples
# Input Output
1 3 4 3
8 13 -40 21
-17 -4 18 12
6-10 13-5
2 3 5 4
1 2 3 4 5
5 4 3 2 1
-7 -8 -7 -8 40