#include <bits/stdc++.h>
using namespace std;
void ASS(bool bb) {
  if (!bb) {
    ++*(int*)0;
  }
}
#pragma comment(linker, "/STACK:106777216")
int cx[1024];
int cy[1024];
long long sx[1024];
long long sy[1024];
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
int Q(int x) { return x * x; }
int main() {
  int n = read();
  int m = read();
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(m); j++) {
      int x = read();
      cx[i] += x;
      cy[j] += x;
    }
  for (int i = 0; i < (int)(n + 1); i++)
    for (int j = 0; j < (int)(n); j++)
      sx[i] += Q(i * 4 - (j * 4 + 2)) * (long long)cx[j];
  for (int i = 0; i < (int)(m + 1); i++)
    for (int j = 0; j < (int)(m); j++)
      sy[i] += Q(i * 4 - (j * 4 + 2)) * (long long)cy[j];
  long long res = (1LL << 63) - 1;
  int bx = -1, by = -1;
  for (int i = 0; i < (int)(n + 1); i++)
    for (int j = 0; j < (int)(m + 1); j++)
      if (res > sx[i] + sy[j]) {
        res = sx[i] + sy[j];
        bx = i;
        by = j;
      }
  cout << res << endl;
  cout << bx << " " << by << endl;
  return 0;
}
