#include <bits/stdc++.h>
using namespace std;
int rarity[1001][1001];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &rarity[i][j]);
  long long ans = -1;
  int ansX, ansY;
  long long sumRow[1001] = {0}, sumCol[1001] = {0};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      sumRow[i] += rarity[i][j];
      sumCol[j] += rarity[i][j];
    }
  for (int i = 0; i <= n; i++) {
    long long sum = 0;
    for (int j = 0; j < n; j++)
      sum += sumRow[j] * (i * 4 - (j * 4 + 2)) * (i * 4 - (j * 4 + 2));
    if (ans == -1 || ans > sum) {
      ans = sum;
      ansX = i;
    }
  }
  long long tmp = -1;
  for (int i = 0; i <= m; i++) {
    long long sum = 0;
    for (int j = 0; j < m; j++)
      sum += sumCol[j] * (i * 4 - (j * 4 + 2)) * (i * 4 - (j * 4 + 2));
    if (tmp == -1 || tmp > sum) {
      tmp = sum;
      ansY = i;
    }
  }
  cout << ans + tmp << endl;
  cout << ansX << " " << ansY << endl;
  return 0;
}
