#include <bits/stdc++.h>
using namespace std;
long long n, m, k, tot, ans, sum;
long long a[1005][1005];
long long sumx[1005], sumy[1005], costx[1005], costy[1005];
long long sqr(long long x) { return x * x; }
char ch;
long long calc(long long x, long long y) {
  if (x < y)
    return (y - x - 1) * 4 + 2;
  else
    return (x - y) * 4 + 2;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      sumx[i] += a[i][j];
      sumy[j] += a[i][j];
    }
  }
  for (int i = 0; i <= n; i++) {
    costx[i] = 0;
    for (int j = 1; j <= n; j++) {
      costx[i] += sumx[j] * sqr(calc(i, j));
    }
  }
  for (int i = 0; i <= m; i++) {
    costy[i] = 0;
    for (int j = 1; j <= m; j++) {
      costy[i] += sumy[j] * sqr(calc(i, j));
    }
  }
  long long maxx = ~0U >> 2, x = 0, y = 0;
  maxx *= maxx;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      long long now = costx[i] + costy[j];
      if (now < maxx) {
        maxx = now;
        x = i;
        y = j;
      }
    }
  cout << maxx << endl;
  cout << x << ' ' << y << endl;
}
