#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  long long xa = 0, xb = 0, xc = 0, ya = 0, yb = 0, yc = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      long long c;
      cin >> c;
      xa += c;
      xb -= 2 * (2 * j + 1) * c;
      xc += (2 * j + 1) * (2 * j + 1) * c;
      ya += c;
      yb -= 2 * (2 * i + 1) * c;
      yc += (2 * i + 1) * (2 * i + 1) * c;
    }
  if (xa == 0 || ya == 0) {
    cout << 0 << endl;
    cout << 0 << " " << 0 << endl;
  } else {
    long long x;
    long long max_x = numeric_limits<long long>::max();
    for (long long j = 0; j <= 2 * m; j += 2) {
      long long curr_x = xa * j * j + xb * j + xc;
      if (curr_x < max_x) {
        x = j / 2;
        max_x = curr_x;
      }
    }
    long long y;
    long long max_y = numeric_limits<long long>::max();
    for (long long j = 0; j <= 2 * n; j += 2) {
      long long curr_y = ya * j * j + yb * j + yc;
      if (curr_y < max_y) {
        y = j / 2;
        max_y = curr_y;
      }
    }
    cout << 4 * (max_x + max_y) << endl;
    cout << y << " " << x << endl;
  }
  return 0;
}
