#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = 1.0 / 0.0f;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int MOD = 1000000007;
inline int LC(int x) { return x << 1; }
inline int RC(int x) { return (x << 1) | 1; }
inline bool eq0(double x) { return fabs(x) < eps; }
inline bool eq(double x, double y) { return fabs(x - y) < eps; }
inline bool ls(double x, double y) { return x + eps < y; }
inline bool gr(double x, double y) { return x - eps > y; }
inline bool greq(double x, double y) { return x + eps >= y; }
inline bool lseq(double x, double y) { return x - eps <= y; }
inline double fmax(double x, double y) { return gr(x, y) ? x : y; }
inline double fmin(double x, double y) { return ls(x, y) ? x : y; }
template <class T>
inline T sqr(T x) {
  return x * x;
}
long long mat[1010][1010];
long long row[1010], col[1010];
long long sumx[1010], sumy[1010];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> mat[i][j];
      row[i] += mat[i][j];
      col[j] += mat[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      sumx[i] += row[j] * sqr((j - i) * 4 + 2);
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      sumy[i] += col[j] * sqr((j - i) * 4 + 2);
    }
  }
  long long ans = LLINF;
  int x, y;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (sumx[i] + sumy[j] < ans) {
        ans = sumx[i] + sumy[j];
        x = i;
        y = j;
      }
    }
  }
  cout << ans << endl;
  cout << x << " " << y << endl;
  return 0;
}
