#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
int n, m, g[1111][1111];
long long int sumx[1111], sumy[1111], costx[1111], costy[1111];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &g[i][j]);
  for (int i = 1; i <= n; i++) {
    long long int sum = 0;
    for (int j = 1; j <= m; j++) sum += 1ll * g[i][j];
    sumx[i] = sum;
  }
  for (int j = 1; j <= m; j++) {
    long long int sum = 0;
    for (int i = 1; i <= n; i++) sum += 1ll * g[i][j];
    sumy[j] = sum;
  }
  for (int i = 0; i <= n + 1; i++) {
    long long int cost = 0;
    for (int j = 1; j <= n; j++)
      cost = cost + sumx[j] * (4 * i - 4 * j - 2) * (4 * i - 4 * j - 2);
    costx[i] = cost;
  }
  for (int j = 0; j <= m + 1; j++) {
    long long int cost = 0;
    for (int i = 1; i <= m; i++)
      cost = cost + sumy[i] * (4 * j - 4 * i - 2) * (4 * j - 4 * i - 2);
    costy[j] = cost;
  }
  int l = 0, r = 0;
  for (int i = 1; i <= n + 1; i++)
    if (costx[i] < costx[l]) l = i;
  for (int j = 1; j <= m + 1; j++)
    if (costy[j] < costy[r]) r = j;
  long long int ans = costx[l] + costy[r];
  --l, --r;
  printf("%I64d\n%d %d\n", ans, max(l, 0), max(r, 0));
  return 0;
}
