#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n, m;
long long c[1024][1024];
long long _uu[1024];
long long _u[1024];
long long _vv[1024];
long long _v[1024];
long long uu(int i) {
  if (_uu[i] == -1) {
    long long sum = 0;
    for (int j = 1; j <= (int)(m); ++j) {
      sum += c[i][j];
    }
    _uu[i] = sum;
  }
  return _uu[i];
}
long long vv(int j) {
  if (_vv[j] == -1) {
    long long sum = 0;
    for (int i = 1; i <= (int)(n); ++i) {
      sum += c[i][j];
    }
    _vv[j] = sum;
  }
  return _vv[j];
}
long long u(int x) {
  if (_u[x] == -1) {
    long long sum = 0;
    for (int i = 1; i <= (int)(n); ++i) {
      long long d = (i - x) * 4 - 2;
      sum += d * d * uu(i);
    }
    _u[x] = sum;
  }
  return _u[x];
}
long long v(int y) {
  if (_v[y] == -1) {
    long long sum = 0;
    for (int j = 1; j <= (int)(m); ++j) {
      long long d = (j - y) * 4 - 2;
      sum += d * d * vv(j);
    }
    _v[y] = sum;
  }
  return _v[y];
}
long long f(int x, int y) { return u(x) + v(y); }
int main() {
  memset(_u, -1, sizeof(_u));
  memset(_uu, -1, sizeof(_uu));
  memset(_v, -1, sizeof(_v));
  memset(_vv, -1, sizeof(_vv));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= (int)(n); ++i) {
    for (int j = 1; j <= (int)(m); ++j) {
      int d;
      scanf("%d", &d);
      c[i][j] = d;
    }
  }
  pair<int, int> b_pos;
  long long b_res = -1;
  for (int x = 0; x < (int)(n + 1); ++x) {
    for (int y = 0; y < (int)(m + 1); ++y) {
      long long r = f(x, y);
      if (b_res == -1 || r < b_res ||
          r == b_res && pair<int, int>(x, y) < b_pos) {
        b_res = r;
        b_pos = pair<int, int>(x, y);
      }
    }
  }
  cout << b_res << endl;
  cout << b_pos.first << ' ' << b_pos.second << endl;
  return 0;
}
