#include <bits/stdc++.h>
using namespace std;
long long int a[1009][1009], n, m, b[1009], c[1009], g, h;
double stepb(double des) {
  long long int sum = 0;
  for (long long int i = 0; i < m; i++) {
    sum += (abs(4 * i + 2 - 4 * des) * abs(4 * i + 2 - 4 * des) * b[i]);
  }
  return sum;
}
double stepc(double des) {
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    sum += (abs(4 * i + 2 - 4 * des) * abs(4 * i + 2 - 4 * des) * c[i]);
  }
  return sum;
}
int main() {
  cin >> n >> m;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      scanf("%lld", &a[i][j]);
      b[j] += a[i][j];
      c[i] += a[i][j];
    }
  }
  long long int mn = 1000000000000000000;
  for (long long int i = 0; i <= n; i++) {
    long long int k = stepc(i);
    if (k < mn) {
      h = i;
      mn = k;
    }
  }
  long long int mm = 1000000000000000000;
  for (long long int i = 0; i <= m; i++) {
    long long int k = stepb(i);
    if (k < mm) {
      g = i;
      mm = k;
    }
  }
  cout << mm + mn << endl;
  cout << h << " " << g << endl;
}
