#include <bits/stdc++.h>
using namespace std;
int C[1000 + 10][1000 + 10];
long long data[1000 + 10];
void solve(int n, int &pos, long long &cost) {
  pos = cost = -1;
  for (int i = 0; i <= n; i++) {
    long long tmp = 0;
    for (int j = 1; j <= n; j++)
      if (j <= i)
        tmp += ((i - j) * 4 + 2) * ((i - j) * 4 + 2) * data[j];
      else
        tmp += ((j - i - 1) * 4 + 2) * ((j - i - 1) * 4 + 2) * data[j];
    if (cost == -1 || tmp < cost) {
      pos = i;
      cost = tmp;
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &C[i][j]);
  int row, col;
  long long cost = 0, tc;
  memset(data, 0, sizeof(data));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) data[i] += C[i][j];
  solve(n, row, tc);
  cost += tc;
  memset(data, 0, sizeof(data));
  for (int j = 1; j <= m; j++)
    for (int i = 1; i <= n; i++) data[j] += C[i][j];
  solve(m, col, tc);
  cost += tc;
  cout << cost << endl << row << " " << col << endl;
  return 0;
}
