#include <bits/stdc++.h>
using namespace std;
long long line[1010], row[1010];
int main() {
  int n, m;
  cin >> n >> m;
  memset(line, 0, sizeof(line));
  memset(row, 0, sizeof(row));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int x;
      cin >> x;
      line[i] += x;
      row[j] += x;
    }
  long long ans = 0;
  long long e, e2;
  int x1, y1;
  e = 1;
  e = e << 62;
  for (int j = 0; j < m; j++) {
    e2 = 0;
    for (int k = 1; k <= m; k++) {
      if (k <= j)
        e2 += (long long)(((j - k) * 4 + 2) * ((j - k) * 4 + 2)) * row[k];
      else
        e2 +=
            (long long)(((k - j - 1) * 4 + 2) * ((k - j - 1) * 4 + 2)) * row[k];
    }
    if (e2 < e)
      e = e2;
    else {
      y1 = j - 1;
      break;
    }
    if (j == m - 1) y1 = m - 1;
  }
  ans += e;
  e = 1;
  e = e << 62;
  for (int i = 0; i < n; i++) {
    e2 = 0;
    for (int k = 1; k <= n; k++) {
      if (k <= i)
        e2 += (long long)(((i - k) * 4 + 2) * ((i - k) * 4 + 2)) * line[k];
      else
        e2 += (long long)(((k - i - 1) * 4 + 2) * ((k - i - 1) * 4 + 2)) *
              line[k];
    }
    if (e2 < e)
      e = e2;
    else {
      x1 = i - 1;
      break;
    }
    if (i == n - 1) x1 = n - 1;
  }
  ans += e;
  cout << ans << endl;
  cout << x1 << ' ' << y1 << endl;
}
