#include <bits/stdc++.h>
using namespace std;
int n, m;
long long h1, h2, m1[1000][1000], m2[1001], m3[1001], ansx, ansy, a1, a2;
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (h1 = 0; h1 < n; h1++)
      for (h2 = 0; h2 < m; h2++) {
        scanf("%I64d", &m1[h1][h2]);
        m2[h1] += m1[h1][h2];
        m3[h2] += m1[h1][h2];
      }
    ansx = 1ll << 60;
    for (h1 = 0; h1 <= n; h1++) {
      long long tmp = 0;
      for (h2 = 0; h2 < n; h2++) {
        tmp += m2[h2] * (h1 * 4 - (h2 * 4 + 2)) * (h1 * 4 - (h2 * 4 + 2));
      }
      if (tmp < ansx) {
        ansx = tmp;
        a1 = h1;
      }
    }
    ansy = 1ll << 60;
    for (h1 = 0; h1 <= m; h1++) {
      long long tmp = 0;
      for (h2 = 0; h2 < m; h2++) {
        tmp += m3[h2] * (h1 * 4 - (h2 * 4 + 2)) * (h1 * 4 - (h2 * 4 + 2));
      }
      if (tmp < ansy) {
        ansy = tmp;
        a2 = h1;
      }
    }
    cout << ansx + ansy << endl << a1 << ' ' << a2 << endl;
  }
}
