#include <bits/stdc++.h>
const double EPS = 1e-9;
const int INT_INF = 1 << 31 - 1;
const long long I64_INF = 1ll << 63 - 1ll;
const double PI = acos(-1.0);
using namespace std;
int n, m;
int c[1000][1000];
int X = 0, Y = 0;
long long answer = I64_INF;
void upd(int x, int y, long long nanswer) {
  if (nanswer < answer) {
    X = x;
    Y = y;
    answer = nanswer;
  }
  if (answer != nanswer) return;
  if (x < X) {
    X = x;
    Y = y;
    answer = nanswer;
  }
  if (x != X) return;
  if (y < Y) {
    X = x;
    Y = y;
    answer = nanswer;
  }
}
long long str[1001];
long long stb[1001];
long long sumstr[1000];
long long sumstb[1000];
int main() {
  scanf("%d%d", &n, &m);
  memset(str, 0, sizeof str);
  memset(stb, 0, sizeof stb);
  memset(sumstr, 0, sizeof sumstr);
  memset(sumstb, 0, sizeof sumstb);
  for (int i = 0; i < (int)n; i++)
    for (int j = 0; j < (int)m; j++) {
      scanf("%d", &c[i][j]);
      sumstr[i] += c[i][j] * 1LL;
      sumstb[j] += c[i][j] * 1LL;
    }
  for (int i = 0; i < (int)n + 1; i++)
    for (int j = 0; j < (int)n; j++) {
      long long dist = (i <= j) ? 4ll * (j - i) + 2ll : 4ll * (i - j) - 2ll;
      str[i] += sumstr[j] * (dist) * (dist);
    }
  for (int i = 0; i < (int)m + 1; i++)
    for (int j = 0; j < (int)m; j++) {
      long long dist = (i <= j) ? 4ll * (j - i) + 2ll : 4ll * (i - j) - 2ll;
      stb[i] += sumstb[j] * (dist) * (dist);
    }
  for (int i = 0; i < (int)n + 1; i++)
    for (int j = 0; j < (int)m + 1; j++) upd(i, j, str[i] + stb[j]);
  printf("%I64d\n%d %d", answer, X, Y);
  return 0;
}
