#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, an1, an2;
int f1[1010], f2[1010];
long long x[1010], y[1010], mi;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &k), f1[i] += k, f2[j] += k;
  for (i = 0; i <= n; i++) {
    int wei = i * 4;
    for (j = 1; j <= n; j++) {
      int h = j * 4 - 2;
      x[i] += 1ll * (wei - h) * (wei - h) * f1[j];
    }
  }
  for (i = 0; i <= m; i++) {
    int wei = i * 4;
    for (j = 1; j <= m; j++) {
      int h = j * 4 - 2;
      y[i] += 1ll * (wei - h) * (wei - h) * f2[j];
    }
  }
  mi = (long long)1e18;
  for (i = 0; i <= n; i++)
    for (j = 0; j <= m; j++) {
      long long sum = x[i] + y[j];
      if (sum < mi) {
        mi = sum;
        an1 = i;
        an2 = j;
      }
    }
  printf("%I64d\n%d %d\n", mi, an1, an2);
  return 0;
}
