#include <bits/stdc++.h>
using namespace std;
const int maxn = 1050;
long long a[maxn][maxn];
long long c[maxn], l[maxn];
long long ansx[maxn], ansy[maxn];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%lld", &a[i][j]);
      c[i] += a[i][j];
      l[j] += a[i][j];
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = i - 1, x = 2; j >= 0; j--, x += 4) ansx[i] += c[j] * x * x;
    for (int j = i, x = 2; j < n; j++, x += 4) ansx[i] += c[j] * x * x;
  }
  for (int i = 0; i <= m; i++) {
    for (int j = i - 1, x = 2; j >= 0; j--, x += 4) ansy[i] += l[j] * x * x;
    for (int j = i, x = 2; j < m; j++, x += 4) ansy[i] += l[j] * x * x;
  }
  int Ansx = 0, Ansy = 0;
  long long tmp = 1e18;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      if (tmp > ansx[i] + ansy[j]) tmp = ansx[i] + ansy[j], Ansx = i, Ansy = j;
  cout << tmp << endl;
  cout << Ansx << " " << Ansy << endl;
}
