Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

В условии задачи недавно были сделаны правки. Просмотреть изменения.

×
B. Guess That Car!

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called "Guess That Car!".

The game show takes place on a giant parking lot, which is 4*n* meters long from north to south and 4*m* meters wide from west to east. The lot has *n* + 1 dividing lines drawn from west to east and *m* + 1 dividing lines drawn from north to south, which divide the parking lot into *n*·*m* 4 by 4 meter squares. There is a car parked strictly inside each square. The dividing lines are numbered from 0 to *n* from north to south and from 0 to *m* from west to east. Each square has coordinates (*i*, *j*) so that the square in the north-west corner has coordinates (1, 1) and the square in the south-east corner has coordinates (*n*, *m*). See the picture in the notes for clarifications.

Before the game show the organizers offer Yura to occupy any of the (*n* + 1)·(*m* + 1) intersection points of the dividing lines. After that he can start guessing the cars. After Yura chooses a point, he will be prohibited to move along the parking lot before the end of the game show. As Yura is a car expert, he will always guess all cars he is offered, it's just a matter of time. Yura knows that to guess each car he needs to spend time equal to the square of the euclidean distance between his point and the center of the square with this car, multiplied by some coefficient characterizing the machine's "rarity" (the rarer the car is, the harder it is to guess it). More formally, guessing a car with "rarity" *c* placed in a square whose center is at distance *d* from Yura takes *c*·*d*^{2} seconds. The time Yura spends on turning his head can be neglected.

It just so happened that Yura knows the "rarity" of each car on the parking lot in advance. Help him choose his point so that the total time of guessing all cars is the smallest possible.

Input

The first line contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 1000) — the sizes of the parking lot. Each of the next *n* lines contains *m* integers: the *j*-th number in the *i*-th line describes the "rarity" *c*_{ij} (0 ≤ *c*_{ij} ≤ 100000) of the car that is located in the square with coordinates (*i*, *j*).

Output

In the first line print the minimum total time Yura needs to guess all offered cars. In the second line print two numbers *l*_{i} and *l*_{j} (0 ≤ *l*_{i} ≤ *n*, 0 ≤ *l*_{j} ≤ *m*) — the numbers of dividing lines that form a junction that Yura should choose to stand on at the beginning of the game show. If there are multiple optimal starting points, print the point with smaller *l*_{i}. If there are still multiple such points, print the point with smaller *l*_{j}.

Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

2 3

3 4 5

3 9 1

Output

392

1 1

Input

3 4

1 0 0 0

0 0 3 0

0 0 5 5

Output

240

2 3

Note

In the first test case the total time of guessing all cars is equal to 3·8 + 3·8 + 4·8 + 9·8 + 5·40 + 1·40 = 392.

The coordinate system of the field:

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/29/2020 13:52:00 (i2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|