#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
const int output_precision = 15;
const bool debug = true;
int N, M;
long long row[1111], col[1111];
inline long long f(long long x) { return x * x; }
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(output_precision);
  cout << fixed;
  cout.tie(0);
  cin >> N >> M;
  for (int(i) = 1, j1234 = N; (i) <= j1234; (i)++)
    for (int(j) = 1, j1234 = M; (j) <= j1234; (j)++) {
      long long foo;
      cin >> foo;
      row[i] += foo;
      col[j] += foo;
    }
  long long bestx = -1, besty = -1;
  int x, y;
  for (int(i) = 0, j1234 = N + 1; (i) < j1234; (i)++) {
    long long cur = 0;
    for (int j = 1; j <= i; j++) cur += f(2 + 4 * (i - j)) * row[j];
    for (int j = i + 1; j <= N; j++) cur += f(2 + 4 * (j - i - 1)) * row[j];
    if (bestx == -1 || bestx > cur) {
      bestx = cur;
      x = i;
    }
  }
  for (int(i) = 0, j1234 = M + 1; (i) < j1234; (i)++) {
    long long cur = 0;
    for (int j = 1; j <= i; j++) cur += f(2 + 4 * (i - j)) * col[j];
    for (int j = i + 1; j <= M; j++) cur += f(2 + 4 * (j - i - 1)) * col[j];
    if (besty == -1 || besty > cur) {
      besty = cur;
      y = i;
    }
  }
  cout << bestx + besty << '\n';
  cout << x << " " << y << '\n';
}
