#include <bits/stdc++.h>
using namespace std;
int val[1010][1010];
int s1[1010];
int s2[1010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &val[i][j]);
    }
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      s1[j] += val[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      s2[i] += val[i][j];
    }
  }
  unsigned long long bestx = 223456789123456789LL, posx;
  for (int i = 0; i <= m; i++) {
    long long ret = 0;
    for (int j = 1; j <= m; j++) {
      ret += (long long)s1[j] * ((i * 4) - ((j - 1) * 4) - 2) *
             ((i * 4) - ((j - 1) * 4) - 2);
    }
    if (ret < bestx) {
      bestx = ret;
      posx = i;
    }
  }
  unsigned long long besty = 223456789123456789LL, posy;
  for (int i = 0; i <= n; i++) {
    long long ret = 0;
    for (int j = 1; j <= n; j++) {
      ret += (long long)s2[j] * ((i * 4) - ((j - 1) * 4) - 2) *
             ((i * 4) - ((j - 1) * 4) - 2);
    }
    if (ret < besty) {
      besty = ret;
      posy = i;
    }
  }
  cout << bestx + besty << endl;
  cout << posy << " " << posx << endl;
  return 0;
}
