#include <bits/stdc++.h>
using namespace std;
long long c[1010][1010];
long long sumx[1010], sumy[1010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%I64d", &c[i][j]);
  for (int i = 0; i < n; i++) {
    sumx[i] = 0;
    for (int j = 0; j < m; j++) sumx[i] += c[i][j];
  }
  for (int i = 0; i < m; i++) {
    sumy[i] = 0;
    for (int j = 0; j < n; j++) sumy[i] += c[j][i];
  }
  int px = 0, py = 0;
  long long cntx = 0, cnty = 0;
  long long d = 2;
  for (int i = 0; i < n; i++, d += 4) cntx += (d * d) * sumx[i];
  d = 2;
  for (int i = 0; i < m; i++, d += 4) cnty += (d * d) * sumy[i];
  for (int i = 1; i <= n; i++) {
    long long k = 4 * i;
    long long tmp = 0;
    for (int j = 0; j < n; j++)
      tmp += ((k - 4 * j - 2) * (k - 4 * j - 2) * sumx[j]);
    if (tmp < cntx) {
      cntx = tmp;
      px = i;
    }
  }
  for (int i = 1; i <= m; i++) {
    long long k = 4 * i;
    long long tmp = 0;
    for (int j = 0; j < m; j++)
      tmp += ((k - 4 * j - 2) * (k - 4 * j - 2) * sumy[j]);
    if (tmp < cnty) {
      cnty = tmp;
      py = i;
    }
  }
  cout << cntx + cnty << endl << px << " " << py << endl;
  return 0;
}
