#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int ts, kk = 1;
int n, m;
int a[1005][1005];
long long int cl[1005], rw[1005];
int x, y;
long long int rs;
int main() {
  int t, i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
      rw[i] += a[i][j];
      cl[j] += a[i][j];
    }
  }
  long long int r1, r2, sm;
  r1 = r2 = LLONG_MAX;
  for (i = 0; i < n + 1; i++) {
    sm = 0;
    for (j = 0; j < n; j++) {
      if (i == j || j + 1 == i) {
        sm += rw[j] * 4;
      } else if (j < i) {
        sm += rw[j] * (((i - j - 1) * 4LL + 2LL) * ((i - j - 1) * 4LL + 2LL));
      } else {
        sm += rw[j] * (((j - i) * 4LL + 2LL) * ((j - i) * 4LL + 2LL));
      }
    }
    if (sm < r1) {
      r1 = sm;
      x = i;
    }
  }
  for (i = 0; i < m + 1; i++) {
    sm = 0;
    for (j = 0; j < m; j++) {
      if (i == j || j + 1 == i) {
        sm += cl[j] * 4LL;
      } else if (j < i) {
        sm += cl[j] * (((i - j - 1) * 4LL + 2LL) * ((i - j - 1) * 4LL + 2LL));
      } else {
        sm += cl[j] * (((j - i) * 4LL + 2LL) * ((j - i) * 4LL + 2LL));
      }
    }
    if (sm < r2) {
      r2 = sm;
      y = i;
    }
  }
  printf("%lld\n%d %d\n", r1 + r2, x, y);
  return 0;
}
