A square sheet of paper is partitioned into N*M equal squares by horizontal and vertical lines, 2 ≤ N ≤ 100, 2 ≤ M ≤ 100, N+M ≥ 7. A natural number not exceeding
The task is to cut out a connected figure according to the following rules:
The first line contains two integers N and M separated by one or more spaces. The next N lines contain M integers each. The integers are separated by one or more spaces.
This unique line contains the sum of the numbers on the found evolvent.
4 4 1 2 3 4 2 4 3 1 5 8 1 3 4 1 3 2
27