#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32000000")
using namespace std;
const double pi = 3.1415926535897932384626433832795;
template <class T>
inline T Sqr(const T &x) {
  return x * x;
}
template <class T>
inline T Abs(const T &x) {
  return x >= 0 ? x : -x;
}
int n, m;
int a[1005][1005];
int sumi[1005], sumj[1005];
void solve() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
      sumi[i] += a[i][j];
      sumj[j] += a[i][j];
    }
  long long mini = 1ll << 62, minj = 1ll << 62;
  int idi = -1, idj = -1;
  for (int i = 0; i <= n; i++) {
    long long t = 0;
    int pos_me = 4 * i;
    for (int j = 0; j < n; j++) {
      int pos_car = 2 + 4 * j;
      t += (pos_me - pos_car) * (pos_me - pos_car) * (long long)sumi[j];
    }
    if (t < mini) {
      mini = t;
      idi = i;
    }
  }
  for (int i = 0; i <= m; i++) {
    long long t = 0;
    int pos_me = 4 * i;
    for (int j = 0; j < m; j++) {
      int pos_car = 2 + 4 * j;
      t += (pos_me - pos_car) * (pos_me - pos_car) * (long long)sumj[j];
    }
    if (t < minj) {
      minj = t;
      idj = i;
    }
  }
  cout << mini + minj << endl << idi << " " << idj;
}
int main() {
  solve();
  return 0;
}
