#include <bits/stdc++.h>
using namespace std;
int a[1100][1100];
long long r[1100], l[1100];
long long x[1100], y[1100];
int n, m;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  memset(r, 0, sizeof(r));
  memset(l, 0, sizeof(l));
  memset(x, 0, sizeof(x));
  memset(y, 0, sizeof(y));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      r[i] += (long long)a[i][j];
      l[j] += (long long)a[i][j];
    }
  for (int i = 0; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      int ii = 4 * i, jj = 4 * j - 2;
      x[i] += (long long)((ii - jj) * (ii - jj)) * r[j];
    }
  }
  for (int i = 0; i <= m; i++) {
    for (int j = 1; j <= m; j++) {
      int ii = 4 * i, jj = 4 * j - 2;
      y[i] += (long long)((ii - jj) * (ii - jj)) * l[j];
    }
  }
  long long ans = 1000000000;
  ans = ans * ans;
  int xx, yy;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      if (x[i] + y[j] < ans) ans = x[i] + y[j], xx = i, yy = j;
    }
  cout << ans << endl;
  cout << xx << ' ' << yy << endl;
  return 0;
}
