#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int c[MAXN][MAXN];
long long sx[MAXN];
long long sy[MAXN];
int N, M;
long long out;
int main() {
  cin >> N >> M;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++) {
      scanf(" %d", &c[i][j]);
      sx[i] += c[i][j];
      sy[j] += c[i][j];
    }
  int lx = 0, ly = 0;
  pair<long long, int> ans = pair<long long, int>(1e18, 0);
  for (int i = 0; i <= N; i++) {
    long long res = 0;
    for (int j = 1; j <= N; j++)
      res += 1LL * (j * 4 - 2 - i * 4) * (j * 4 - 2 - i * 4) * sx[j];
    ans = min(ans, pair<long long, int>(res, i));
  }
  lx = ans.second;
  out = ans.first;
  ans = pair<long long, int>(1e18, 0);
  for (int i = 0; i <= M; i++) {
    long long res = 0;
    for (int j = 1; j <= M; j++)
      res += 1LL * (j * 4 - 2 - i * 4) * (j * 4 - 2 - i * 4) * sy[j];
    ans = min(ans, pair<long long, int>(res, i));
  }
  ly = ans.second;
  cout << out + ans.first << endl << lx << " " << ly << endl;
  return 0;
}
