#include <bits/stdc++.h>
using namespace std;
const int M = 1000 + 10;
long long int a[M][M];
long long int prerow[M];
long long int precol[M];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int col = 0; col < m; col++) {
    for (int row = 0; row < n; row++) {
      precol[col] += a[row][col];
    }
  }
  int y = -1;
  long long int miny = -1;
  for (int col = 0; col <= m; col++) {
    long long int tsum = 0;
    for (int j = 0; j < m; j++) {
      if (j >= col) {
        tsum = tsum + ((j - col) * 4 + 2) * ((j - col) * 4 + 2) * precol[j];
      } else {
        tsum = tsum +
               ((col - 1 - j) * 4 + 2) * ((col - 1 - j) * 4 + 2) * precol[j];
      }
    }
    if (miny == -1) {
      miny = tsum;
      y = col;
    } else {
      if (tsum < miny) {
        miny = tsum;
        y = col;
      }
    }
  }
  for (int row = 0; row < n; row++) {
    for (int col = 0; col < m; col++) {
      prerow[row] += a[row][col];
    }
  }
  int x = -1;
  long long int minx = -1;
  for (int row = 0; row < n; row++) {
    long long int tsum = 0;
    for (int j = 0; j < n; j++) {
      if (j >= row) {
        tsum = tsum + ((j - row) * 4 + 2) * ((j - row) * 4 + 2) * prerow[j];
      } else {
        tsum = tsum +
               ((row - 1 - j) * 4 + 2) * ((row - 1 - j) * 4 + 2) * prerow[j];
      }
    }
    if (minx == -1) {
      minx = tsum;
      x = row;
    } else {
      if (tsum < minx) {
        minx = tsum;
        x = row;
      }
    }
  }
  cout << minx + miny << endl;
  cout << x << " " << y << endl;
  return 0;
}
