#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const int MOD = 1000000007;
int c[1001][1001], sr[1001], sc[1001];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) cin >> c[i][j];
  memset(sr, 0, sizeof(sr));
  memset(sc, 0, sizeof(sc));
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) sr[i] += c[i][j];
  for (int j = 1; j <= m; ++j)
    for (int i = 1; i <= n; ++i) sc[j] += c[i][j];
  long long res = 0;
  int x = -1;
  long long r = inf * (long long)inf;
  for (int i = 0; i <= n; ++i) {
    long long s = 0;
    for (int ii = 1; ii <= n; ++ii)
      s += ((4 * ii - 2 - 4 * i) * (4 * ii - 2 - 4 * i)) * (long long)sr[ii];
    if (s < r) {
      x = i;
      r = s;
    }
  }
  res += r;
  int y = -1;
  r = inf * (long long)inf;
  for (int j = 0; j <= m; ++j) {
    long long s = 0;
    for (int jj = 1; jj <= m; ++jj)
      s += ((4 * jj - 2 - 4 * j) * (4 * jj - 2 - 4 * j)) * (long long)sc[jj];
    if (s < r) {
      y = j;
      r = s;
    }
  }
  cout << res + r << endl;
  cout << x << " " << y << endl;
  return 0;
}
