#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
int c[1050][1050];
long long d[1050], dj[1050];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &c[i][j]);
  long long t = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      t += (long long)((4 * i + 2) * (4 * i + 2) + (4 * j + 2) * (4 * j + 2)) *
           c[i][j];
  for (int j = 0; j < m; j++) {
    d[j] = 0;
    for (int i = 0; i < n; i++) d[j] += c[i][j];
  }
  for (int i = 0; i < n; i++) {
    dj[i] = 0;
    for (int j = 0; j < m; j++) dj[i] += c[i][j];
  }
  long long sjplus, sjminus, djpl, djmin;
  sjplus = 0;
  sjminus = 0;
  djpl = 0;
  djmin = 0;
  for (int i = 0; i < n; i++) {
    sjminus += dj[i] * 32 * (i + 1);
    djmin += dj[i];
  }
  long long splus, sminus, dpl, dmin;
  long long mint = t;
  int mini = 0, minj = 0;
  long long tt[1050];
  tt[0] = t;
  long long tmp;
  for (int curi = 0; curi <= n; curi++) {
    splus = 0;
    sminus = 0;
    dpl = 0;
    dmin = 0;
    for (int j = 0; j < m; j++) {
      sminus += d[j] * 32 * (j + 1);
      dmin += d[j];
    }
    if (curi != 0) {
      djmin -= dj[curi - 1];
      sjminus -= 32 * djmin + 32 * dj[curi - 1];
      if (curi >= 3) djpl += 32 * dj[curi - 3];
      sjplus += djpl;
      if (curi >= 2) sjplus += 32 * dj[curi - 2];
      t = tt[curi - 1] + sjplus - sjminus;
      if (t < mint) {
        mini = curi;
        minj = 0;
        mint = t;
      }
      tt[curi] = t;
    }
    for (int curj = 1; curj <= m; curj++) {
      dmin -= d[curj - 1];
      sminus -= 32 * dmin + 32 * d[curj - 1];
      if (curj >= 3) dpl += 32 * d[curj - 3];
      splus += dpl;
      if (curj >= 2) splus += 32 * d[curj - 2];
      t += splus - sminus;
      if (t < mint) {
        mini = curi;
        minj = curj;
        mint = t;
      }
    }
  }
  cout << mint << endl;
  cout << mini << " " << minj << endl;
  return 0;
}
