Cost Count

Author: QuwsarOhi

Problem Setter: Murad Al Wajed

Intake 26, Department of CSE

Mr. Samir likes to play with blocks. A block has 6 sides. Left, Right, Front, Back, Top, and Bottom. The size of a block is (1*1*1). He makes building on a (H*W) square unit area. But in every coordinate, the number of blocks can be different.





Now he wants to recolor only one side of the building. Coloring a single side of a (1*1*1) block requires 1 unit of cost.  You need to calculate the minimum cost and help him to choose the side of the building.

Input Format

The first line contains the value of  W (W <101) and  (H <101).

The next W lines contain H space-separated integers.

The jth  integer in ith  line denotes the number of blocks (<101) in (i,j) position.

Output Format

Just print the minimum cost to paint only one side of the building (open-sided block).

Samples

Input
3 3 1 2 1 3 2 2 4 3 4
Output
10
Input
3 3 1 1 1 1 1 1 1 1 1
Output
3
Limits
Language Time Memory
GNU C 11 1s 512MB
GNU C++ 14 1s 512MB
GNU C++ 11 1s 512MB
PHP 7 1s 1024MB
Java (OpenJDK 8) 1s 4096MB
Statistics
Login To Submit