#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int n, m;
int c[MAXN][MAXN];
long long w[MAXN], k[MAXN];
long long res[MAXN][MAXN];
long long kwa[MAXN];
int rx, ry;
void readData() {
  cin >> n >> m;
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (m); ++j) {
      cin >> c[i][j];
    }
  }
}
void liczKwa() {
  for (int i = 0; i < (MAXN - 2); ++i) {
    kwa[i] = (2 + 4 * i) * (2 + 4 * i);
  }
}
void licz() {
  for (int i = 0; i <= (n); ++i) {
    for (int j = 0; j <= (m); ++j) {
      w[i] = w[i] + c[i][j];
    }
  }
  for (int j = 0; j <= (m); ++j) {
    for (int i = 0; i <= (n); ++i) {
      k[j] = k[j] + c[i][j];
    }
  }
}
void skoncz() {
  long long obe = 0;
  for (int i = 0; i <= (n); ++i) {
    obe = 0;
    for (int q = i - 1; q >= (0); --q) {
      obe += w[q] * kwa[i - q - 1];
    }
    for (int q = i; q <= (n - 1); ++q) {
      obe += w[q] * kwa[q - i];
    }
    for (int j = 0; j <= (m); ++j) {
      res[i][j] += obe;
    }
  }
  for (int j = 0; j <= (m); ++j) {
    obe = 0;
    for (int q = j - 1; q >= (0); --q) {
      obe += k[q] * kwa[j - q - 1];
    }
    for (int q = j; q <= (m - 1); ++q) {
      obe += k[q] * kwa[q - j];
    }
    for (int i = 0; i <= (n); ++i) {
      res[i][j] += obe;
    }
  }
  rx = 0;
  ry = 0;
  for (int i = 0; i <= (n); ++i) {
    for (int j = 0; j <= (m); ++j) {
      if (res[i][j] < res[rx][ry]) {
        rx = i;
        ry = j;
      }
    }
  }
}
int main() {
  readData();
  liczKwa();
  licz();
  skoncz();
  cout << res[rx][ry] << endl;
  cout << rx << " " << ry << endl;
}
