#include <bits/stdc++.h>
using namespace std;
long long sumx[4010], sumy[4010], t;
int n, m;
int X, Y;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int v;
      cin >> v;
      sumx[i] += v;
      sumy[j] += v;
    }
  }
  long long mx1 = -1;
  for (int i = 0; i <= n; i++) {
    long long c = 0;
    for (int j = 0; j < n; j++) {
      c += sumx[j] * (4 * i - (4 * j + 2)) * (i * 4 - (4 * j + 2));
    }
    if (mx1 == -1 || c < mx1) X = i, mx1 = c;
  }
  long long mx2 = -1;
  for (int i = 0; i <= m; i++) {
    long long c = 0;
    for (int j = 0; j < m; j++) {
      c += sumy[j] * (i * 4 - (4 * j + 2)) * (i * 4 - (4 * j + 2));
    }
    if (mx2 == -1 || c < mx2) Y = i, mx2 = c;
  }
  cout << mx1 + mx2 << endl;
  cout << X << " " << Y << endl;
}
