#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long sq(long long a) { return a * a; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<long long> row(n), col(m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int a;
      cin >> a;
      row[i] += a, col[j] += a;
    }
  }
  long long resx = LLONG_MAX;
  int topx;
  for (int x = 0; x < n; x++) {
    long long curans = 0;
    for (int i = 0; i < n; i++) {
      curans += row[i] * sq(x * 4 - 4 * i - 2);
    }
    if (curans < resx) {
      resx = curans, topx = x;
    }
  }
  long long resy = LLONG_MAX;
  int topy;
  for (int y = 0; y < m; y++) {
    long long curans = 0;
    for (int i = 0; i < m; i++) {
      curans += col[i] * sq(y * 4 - 4 * i - 2);
    }
    if (curans < resy) {
      resy = curans, topy = y;
    }
  }
  cout << resx + resy << '\n' << topx << " " << topy << '\n';
}
