#include <bits/stdc++.h>
using namespace std;
long long INF = 1000000000000000000;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  vector<vector<long long> > a(n);
  for (int i = 0; i < n; ++i) {
    int x;
    for (int j = 0; j < m; ++j) {
      cin >> x;
      a[i].push_back(x);
    }
  }
  vector<long long> X(n, 0), Y(m, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      X[i] += a[i][j];
      Y[j] += a[i][j];
    }
  }
  long long czasX = INF;
  long long x = INF;
  for (int i = 0; i <= n; ++i) {
    long long czas = 0;
    for (int j = 0; j < n; ++j)
      czas += X[j] * ((4 * i) - (4 * j + 2)) * ((4 * i) - (4 * j + 2));
    if (czas < czasX) {
      czasX = czas;
      x = i;
    }
  }
  long long czasY = INF;
  long long y = INF;
  for (int i = 0; i <= m; ++i) {
    long long czas = 0;
    for (int j = 0; j < m; ++j)
      czas += Y[j] * ((4 * i) - (4 * j + 2)) * ((4 * i) - (4 * j + 2));
    if (czas < czasY) {
      czasY = czas;
      y = i;
    }
  }
  cout << czasX + czasY << endl;
  cout << x << " " << y;
  return 0;
}
