#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;
int n, m, r[MAXN][MAXN], maxx, maxy;
long long sr[MAXN], sc[MAXN];
long long sy[MAXN], sx[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> r[i][j];
      sr[i + 1] += r[i][j];
      sc[j + 1] += r[i][j];
    }
  for (int t = 0; t <= n; t++) {
    int dx = t * 4, dpx;
    for (int j = 1; j <= n; j++) {
      dpx = abs(dx - ((j - 1) * 4 + 2));
      sx[t] += dpx * dpx * sr[j];
    }
  }
  for (int t = 0; t <= m; t++) {
    int dy = t * 4, dpy;
    for (int j = 1; j <= m; j++) {
      dpy = abs(dy - ((j - 1) * 4 + 2));
      sy[t] += dpy * dpy * sc[j];
    }
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      if (sx[i] + sy[j] < sx[maxx] + sy[maxy]) maxx = i, maxy = j;
  cout << sx[maxx] + sy[maxy] << endl;
  cout << maxx << ' ' << maxy;
}
