#include <bits/stdc++.h>
using namespace std;
int X, Y;
int a[1010][1010];
long long sumx[1010], sumy[1010];
long long costx[1010], costy[1010];
int main(void) {
  int i, j;
  cin >> X >> Y;
  for ((i) = 0; (i) < (int)(X); (i)++)
    for ((j) = 0; (j) < (int)(Y); (j)++) cin >> a[i][j];
  for ((i) = 0; (i) < (int)(X); (i)++)
    for ((j) = 0; (j) < (int)(Y); (j)++) {
      sumx[i] += a[i][j];
      sumy[j] += a[i][j];
    }
  for ((i) = 0; (i) < (int)(X + 1); (i)++)
    for ((j) = 0; (j) < (int)(X); (j)++)
      costx[i] += sumx[j] * (2 * i - 2 * j - 1) * (2 * i - 2 * j - 1);
  for ((i) = 0; (i) < (int)(Y + 1); (i)++)
    for ((j) = 0; (j) < (int)(Y); (j)++)
      costy[i] += sumy[j] * (2 * i - 2 * j - 1) * (2 * i - 2 * j - 1);
  int ansx = 0, ansy = 0;
  for ((i) = 0; (i) < (int)(X + 1); (i)++)
    if (costx[i] < costx[ansx]) ansx = i;
  for ((i) = 0; (i) < (int)(Y + 1); (i)++)
    if (costy[i] < costy[ansy]) ansy = i;
  cout << 4 * (costx[ansx] + costy[ansy]) << endl
       << ansx << ' ' << ansy << endl;
  ;
  return 0;
}
