#include <bits/stdc++.h>
long long d[1010];
long long d2[1010];
int n, m;
long long dp[1010];
long long dpr[1010];
void solve(long long d[1010], int len, int& x, long long& val) {
  memset(dp, 0, sizeof(dp));
  memset(dpr, 0, sizeof(dpr));
  long long sum = 0;
  long long cnt = 0;
  dp[0] = 0;
  for (int i = 1; i <= len; ++i) {
    dp[i] = d[i - 1] * 4 + 8 * sum + 16 * cnt + dp[i - 1];
    sum += 4 * cnt + 2 * d[i - 1];
    cnt += d[i - 1];
  }
  dpr[len] = 0;
  sum = 0;
  cnt = 0;
  for (int i = len - 1; i >= 0; --i) {
    dpr[i] = d[i] * 4 + 8 * sum + 16 * cnt + dpr[i + 1];
    sum += 4 * cnt + 2 * d[i];
    cnt += d[i];
  }
  val = 1LL << 62;
  for (int i = 0; i <= len; ++i) {
    if (val > dp[i] + dpr[i]) {
      val = dp[i] + dpr[i];
      x = i;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int t;
      scanf("%d", &t);
      d[i] += t;
      d2[j] += t;
    }
  }
  int x, y;
  long long vx, vy;
  solve(d, n, x, vx);
  solve(d2, m, y, vy);
  printf("%I64d\n%d %d\n", vx + vy, x, y);
  return 0;
}
