#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <typename T>
inline T sqr(T a) {
  return a * a;
}
const long long INF = 1LL << 62;
const int N = 1e3 + 10;
long long car[N][N], row[N], col[N];
int n, m;
pair<int, long long> GetMin(long long num[], int bound) {
  int ret = 0;
  long long ret_value = INF;
  for (int i = 0; i <= bound; i++) {
    int pos = i * 4;
    long long tmp = 0;
    for (int j = 2; j < 4 * bound; j += 4) tmp += sqr(pos - j) * num[j / 4];
    if (ret_value > tmp) {
      ret = i;
      ret_value = tmp;
    }
  }
  return make_pair(ret, ret_value);
}
int main() {
  while (cin >> n >> m) {
    memset(row, 0, sizeof(row));
    memset(col, 0, sizeof(col));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        scanf("%I64dd", &car[i][j]);
        row[i] += car[i][j];
        col[j] += car[i][j];
      }
    }
    pair<int, long long> x = GetMin(row, n), y = GetMin(col, m);
    cout << x.second + y.second << endl;
    cout << x.first << " " << y.first << endl;
  }
  return 0;
}
