#include <bits/stdc++.h>
using namespace std;
long long row[1000];
long long col[1000];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int c;
      scanf("%d", &c);
      row[i] += c;
      col[j] += c;
    }
  }
  long long rowscore = LLONG_MAX;
  long long bestrow = 0;
  for (long long r = 0; r <= n; r++) {
    long long score = 0;
    for (long long i = 0; i < n; i++)
      score += (4 * i + 2 - 4 * r) * (4 * i + 2 - 4 * r) * row[i];
    if (score < rowscore) rowscore = score, bestrow = r;
  }
  long long colscore = LLONG_MAX;
  long long bestcol = 0;
  for (long long c = 0; c <= m; c++) {
    long long score = 0;
    for (long long j = 0; j < m; j++)
      score += (4 * j + 2 - 4 * c) * (4 * j + 2 - 4 * c) * col[j];
    if (score < colscore) colscore = score, bestcol = c;
  }
  printf("%lld\n%lld %lld\n", rowscore + colscore, bestrow, bestcol);
  return 0;
}
