#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<long long>> a =
      vector<vector<long long>>(n, vector<long long>(m, 0));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  vector<long long> col(m, 0), row(n, 0);
  for (int i = 0; i < m; ++i)
    for (int j = 0; j < n; ++j) col[i] += a[j][i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) row[i] += a[i][j];
  vector<long long> x(m + 1), y(n + 1);
  long long mn = LLONG_MAX;
  long long ans = 0;
  int ansx = 0;
  for (int i = 0; i <= m; ++i) {
    long long curx = i * 4;
    for (int j = 0; j < m; ++j) {
      long long curpos = j * 4 + 2;
      long long dx = curx - curpos;
      x[i] += dx * dx * col[j];
    }
    if (x[i] < mn) {
      mn = x[i];
      ansx = i;
    }
  }
  ans += mn;
  mn = LLONG_MAX;
  int ansy = 0;
  for (int i = 0; i <= n; ++i) {
    int cury = i * 4;
    for (int j = 0; j < n; ++j) {
      long long curpos = j * 4 + 2;
      long long dy = cury - curpos;
      y[i] += dy * dy * row[j];
    }
    if (y[i] < mn) {
      mn = y[i];
      ansy = i;
    }
  }
  ans += mn;
  cout << ans << '\n';
  cout << ansy << ' ' << ansx << '\n';
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 1;
  while (tc--) {
    solve();
  }
}
