#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, mi, mj;
  uint64_t tmp, prev, x, y, vsum[1000] = {0}, hsum[1000] = {0};
  cin >> n;
  cin >> m;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      cin >> tmp;
      hsum[i] += tmp;
      vsum[j] += tmp;
    }
  prev = (vsum[0]) * ((0 - 0) * 4 - 2) * ((0 - 0) * 4 - 2) + 1;
  for (i = 0; i <= m; i++) {
    tmp = 0;
    for (j = 0; j < m; j++) {
      tmp += (vsum[j]) * ((i - j) * 4 - 2) * ((i - j) * 4 - 2);
    }
    if (i > 0 && tmp >= prev) {
      mi = i - 1;
      x = prev;
      break;
    }
    prev = tmp;
  }
  prev = (hsum[0]) * ((0 - 0) * 4 - 2) * ((0 - 0) * 4 - 2) + 1;
  for (i = 0; i <= n; i++) {
    tmp = 0;
    for (j = 0; j < n; j++) {
      tmp += (hsum[j]) * ((i - j) * 4 - 2) * ((i - j) * 4 - 2);
    }
    if (i > 0 && tmp >= prev) {
      mj = i - 1;
      y = prev;
      break;
    }
    prev = tmp;
  }
  cout << x + y << endl;
  cout << mj << ' ' << mi << endl;
}
