#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
void solve(const int n, const long long a[N], int &ansp, long long &ans) {
  ansp = -1;
  ans = -1;
  for (int i = 0; i <= n; ++i) {
    long long now = 0;
    for (int j = 0; j < n; ++j) {
      if (j >= i) {
        now += (((j - i) * 4 + 2) * ((j - i) * 4 + 2)) * a[j];
      } else
        now += (((i - j - 1) * 4 + 2) * ((i - j - 1) * 4 + 2)) * a[j];
    }
    if (now < ans || ans == -1) {
      ansp = i;
      ans = now;
    }
  }
}
long long a[N][N], r[N], c[N];
int n, m;
int main() {
  cin >> n >> m;
  memset(r, 0, sizeof(r));
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> a[i][j];
      r[i] += a[i][j];
      c[j] += a[i][j];
    }
  }
  int ansi, ansj;
  long long ansr, ansc;
  solve(n, r, ansi, ansr);
  solve(m, c, ansj, ansc);
  printf("%I64d\n%d %d\n", ansr + ansc, ansi, ansj);
}
