#include <bits/stdc++.h>
using namespace std;
long long r[1010], c[1010];
long long mp[1010][1010];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= n; i++) r[i] = 0;
  for (int j = 0; j <= m; j++) c[j] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &mp[i][j]);
      r[i] += mp[i][j];
      c[j] += mp[i][j];
    }
  }
  long long a1 = -1, a2 = -1;
  int id1, id2;
  for (int i = 0; i <= n; i++) {
    long long cnt = 0;
    for (int j = 1; j <= n; j++) {
      cnt += abs(j * 4 - 2 - i * 4) * abs(j * 4 - 2 - i * 4) * r[j];
    }
    if (a1 == -1 || (a1 != -1 && cnt < a1)) a1 = cnt, id1 = i;
  }
  for (int i = 0; i <= m; i++) {
    long long cnt = 0;
    for (int j = 1; j <= m; j++) {
      cnt += abs(j * 4 - 2 - i * 4) * abs(j * 4 - 2 - i * 4) * c[j];
    }
    if (a2 == -1 || (a2 != -1 && cnt < a2)) a2 = cnt, id2 = i;
  }
  printf("%I64d\n", a1 + a2);
  printf("%d %d\n", id1, id2);
  return 0;
}
