#include <bits/stdc++.h>
using namespace std;
long long fld[1010][1010];
long long trr[1010], trc[1010];
long long costr[1010], costc[1010];
int main(void) {
  int n, m;
  cin.sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> fld[i][j];
    }
  }
  for (int i = 0; i < n; ++i) {
    trr[i] = 0;
    for (int j = 0; j < m; ++j) {
      trr[i] += fld[i][j];
    }
  }
  for (int i = 0; i < m; ++i) {
    trc[i] = 0;
    for (int j = 0; j < n; ++j) {
      trc[i] += fld[j][i];
    }
  }
  for (int i = 0; i <= n; ++i) {
    costr[i] = 0;
    long long dst = 2;
    for (int j = i - 1; j > -1; --j) {
      costr[i] += dst * dst * trr[j];
      dst += 4;
    }
    dst = 2;
    for (int j = i; j < n; ++j) {
      costr[i] += dst * dst * trr[j];
      dst += 4;
    }
  }
  for (int i = 0; i <= m; ++i) {
    costc[i] = 0;
    long long dst = 2;
    for (int j = i - 1; j > -1; --j) {
      costc[i] += dst * dst * trc[j];
      dst += 4;
    }
    dst = 2;
    for (int j = i; j < m; ++j) {
      costc[i] += dst * dst * trc[j];
      dst += 4;
    }
  }
  int minr = 0, minc = 0;
  for (int i = 1; i <= n; ++i) {
    if (costr[minr] > costr[i]) {
      minr = i;
    }
  }
  for (int i = 1; i <= m; ++i) {
    if (costc[minc] > costc[i]) {
      minc = i;
    }
  }
  cout << costr[minr] + costc[minc] << endl << minr << " " << minc << endl;
  return 0;
}
