#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 3;
int C[MAXN][MAXN];
long long sX[MAXN], sY[MAXN], rX[MAXN], rY[MAXN];
int main() {
  int N, M, retX = -1, retY = -1;
  long long ret = -1;
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++) {
    for (int ii = 0; ii < M; ii++) {
      scanf("%d", &C[i][ii]);
      sX[ii] += C[i][ii];
      sY[i] += C[i][ii];
    }
  }
  for (int i = 0; i <= M; i++) {
    for (int ii = 0; ii < M; ii++) {
      rX[i] += sX[ii] * 4 * (i * 2 - 2 * ii - 1) * (i * 2 - 2 * ii - 1);
    }
  }
  for (int i = 0; i <= N; i++) {
    for (int ii = 0; ii < N; ii++) {
      rY[i] += sY[ii] * 4 * (i * 2 - 2 * ii - 1) * (i * 2 - 2 * ii - 1);
    }
  }
  for (int i = 0; i <= N; i++) {
    for (int ii = 0; ii <= M; ii++) {
      long long res = rX[ii] + rY[i];
      if (retX == -1 || res < ret) ret = res, retX = i, retY = ii;
    }
  }
  printf("%I64d\n%d %d\n", ret, retX, retY);
}
