#include <bits/stdc++.h>
using namespace std;
int N, M;
long long pow2(long long a) { return a * a; }
long long calcScore(int x, int X, vector<long long> &weightSum) {
  long long score = 0;
  long long x_loc = 4 * x;
  for (int x2 = 0; x2 < X; ++x2) {
    long long x2_loc = 2 + 4 * x2;
    long long dist2 = pow2(x_loc - x2_loc);
    score += dist2 * weightSum[x2];
  }
  return score;
}
int main(void) {
  cin >> N >> M;
  vector<long long> weightSumHorz(M);
  vector<long long> weightSumVert(N);
  for (int n = 0; n < N; ++n) {
    for (int m = 0; m < M; ++m) {
      long long tmp;
      cin >> tmp;
      weightSumHorz[m] += tmp;
      weightSumVert[n] += tmp;
    }
  }
  vector<long long> scoreHorz(M + 1);
  vector<long long> scoreVert(N + 1);
  long long best_score_m = 1LL << 62;
  int best_m = -1;
  for (int m = 0; m <= M; ++m) {
    long long score = calcScore(m, M, weightSumHorz);
    if (score < best_score_m) {
      best_score_m = score;
      best_m = m;
    }
  }
  long long best_score_n = 1LL << 62;
  int best_n = -1;
  for (int n = 0; n <= N; ++n) {
    long long score = calcScore(n, N, weightSumVert);
    if (score < best_score_n) {
      best_score_n = score;
      best_n = n;
    }
  }
  cout << (best_score_m + best_score_n) << endl;
  cout << best_n << " " << best_m << endl;
  return 0;
}
