#include <bits/stdc++.h>
using namespace std;
long long inf = (long long)1 << 63 - 1;
const int N = 1005;
long long sx[N], sy[N];
int a[N][N];
long long cal(int i, int j) {
  long long x;
  if (i > j)
    x = (i - j) * 4 + 2;
  else
    x = (j - i) * 4 - 2;
  return x * x;
}
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", &a[i][j]);
    }
  }
  int x;
  long long sumx = inf;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      sx[i] += a[i][j];
    }
  }
  for (int i = 0; i <= n; i++) {
    long long s = 0;
    for (int j = 1; j <= n; j++) {
      s += sx[j] * cal(i, j);
    }
    if (s < sumx) {
      sumx = s;
      x = i;
    }
  }
  int y;
  long long sumy = inf;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      sy[j] += a[i][j];
    }
  }
  for (int i = 0; i <= m; i++) {
    long long s = 0;
    for (int j = 1; j <= m; j++) {
      s += sy[j] * cal(i, j);
    }
    if (s < sumy) {
      sumy = s;
      y = i;
    }
  }
  printf("%I64d\n%d %d\n", sumx + sumy, x, y);
  return 0;
}
