#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1024;
int n, m, mat[MAXN][MAXN];
long long row[MAXN], column[MAXN], sum[MAXN];
long long sqr(long long x) { return x * x; }
void calc(int n, int m, long long *x) {
  for (int i = 0; i < n; i++) {
    sum[i] = 0;
    for (int j = 0; j < m; j++) {
      sum[i] += mat[i][j];
    }
  }
  for (int i = 0; i <= n; i++) {
    x[i] = 0;
    for (int j = 0; j < i; j++) {
      x[i] += sqr((i - j - 1) * 4 + 2) * sum[j];
    }
    for (int j = i; j < n; j++) {
      x[i] += sqr((j - i) * 4 + 2) * sum[j];
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &mat[i][j]);
    }
  }
  calc(n, m, row);
  for (int i = 0; i < max(n, m); i++) {
    for (int j = i; j < max(n, m); j++) {
      swap(mat[i][j], mat[j][i]);
    }
  }
  calc(m, n, column);
  int resR = 0, resC = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (row[resR] + column[resC] > row[i] + column[j]) {
        resR = i;
        resC = j;
      }
    }
  }
  printf("%I64d\n%d %d\n", row[resR] + column[resC], resR, resC);
  return 0;
}
