#include <bits/stdc++.h>
using namespace std;
long long sqr(long long a) { return a * a; }
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  vector<long long> sumx(n, 0ll);
  vector<long long> sumy(m, 0ll);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      long long c;
      cin >> c;
      sumx[i] += c;
      sumy[j] += c;
    }
  }
  vector<long long> ansx(n + 1, 0ll);
  vector<long long> ansy(m + 1, 0ll);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < n; j++) {
      ansx[i] += sumx[j] * sqr((2 * j + 1) - 2 * i);
    }
  }
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j < m; j++) {
      ansy[i] += sumy[j] * sqr((2 * j + 1) - 2 * i);
    }
  }
  pair<long long, pair<int, int> > res =
      make_pair((long long)1e18, make_pair(-1, -1));
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      res = min(res, make_pair(ansx[i] + ansy[j], make_pair(i, j)));
    }
  }
  cout << 4 * res.first << endl;
  cout << res.second.first << " " << res.second.second << endl;
  return 0;
}
