#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
long long a[N], b[N];
int dist(int a, int b) {
  int ret = 0;
  if (a > b)
    ret = 4 * (a - b) - 2;
  else
    ret = 4 * (b - a) + 2;
  return ret * ret;
}
int main() {
  ios::sync_with_stdio(false);
  long long ans = 0;
  int n, m, x, y;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int val;
      cin >> val;
      a[i] += val;
      b[j] += val;
    }
  }
  long long mn = -1;
  for (int i = 0; i <= n; i++) {
    long long sum = 0;
    for (int j = 0; j < n; j++) sum += a[j] * dist(i, j);
    if (mn == -1 || sum < mn) mn = sum, x = i;
  }
  ans += mn;
  mn = -1;
  for (int i = 0; i <= m; i++) {
    long long sum = 0;
    for (int j = 0; j < m; j++) sum += b[j] * dist(i, j);
    if (mn == -1 || sum < mn) mn = sum, y = i;
  }
  ans += mn;
  cout << ans << endl << x << " " << y << endl;
  return 0;
}
