#include <bits/stdc++.h>
using namespace std;
const long long mod7 = 1000000007;
const long long mod9 = 1000000009;
const int linf = 2000000000;
const long long llinf = 1000000000000000000ll;
ifstream in("series.in");
ofstream out("series.out");
long long arr[1001][1001];
long long X[1001], Y[1001];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> arr[i][j];
      X[j] += arr[i][j];
      Y[i] += arr[i][j];
    }
  }
  long long dx = -1, dy = -1;
  int x = -1, y = -1;
  for (int i = 0; i <= m; ++i) {
    long long temp = 0;
    for (int j = 1; j <= m; ++j) {
      temp += X[j] * (4 * i - (4 * j - 2)) * (4 * i - (4 * j - 2));
    }
    if (dx == -1 || dx > temp) {
      x = i;
      dx = temp;
    }
  }
  for (int i = 0; i <= n; ++i) {
    long long temp = 0;
    for (int j = 1; j <= n; ++j) {
      temp += Y[j] * (4 * i - (4 * j - 2)) * (4 * i - (4 * j - 2));
    }
    if (dy == -1 || dy > temp) {
      y = i;
      dy = temp;
    }
  }
  cout << dx + dy << endl << y << ' ' << x;
  return 0;
}
