#include <bits/stdc++.h>
using namespace std;
int n, m;
int s[1001][1001];
long long fx[1001], fy[1001], sum1[1001], sum2[1001];
int main() {
  int i, j, x, y, x0, y0;
  bool f;
  long long min;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++)
    for (sum1[i] = 0, j = 1; j <= m; j++)
      scanf("%d", &s[i][j]), sum1[i] += s[i][j];
  for (i = 1; i <= m; i++)
    for (sum2[i] = 0, j = 1; j <= n; j++) sum2[i] += s[j][i];
  for (x = 0; x <= n; x++) {
    fx[x] = 0;
    for (i = 1; i <= n; i++)
      fx[x] += sum1[i] * (2 * x - 2 * i + 1) * (2 * x - 2 * i + 1);
  }
  for (y = 0; y <= m; y++) {
    fy[y] = 0;
    for (j = 1; j <= m; j++)
      fy[y] += sum2[j] * (2 * y - 2 * j + 1) * (2 * y - 2 * j + 1);
  }
  min = fx[0] + fy[0];
  x0 = y0 = 0;
  for (x = 0; x <= n; x++)
    for (y = 0; y <= m; y++)
      if (min > fx[x] + fy[y]) min = fx[x] + fy[y], x0 = x, y0 = y;
  cout << min * 4 << endl;
  cout << x0 << " " << y0 << endl;
  return 0;
}
