#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, p = 0, q = 0;
  long long c = 0, d = 0, s = 0, t = 0, u = 0, v = 0;
  scanf("%d %d", &n, &m);
  for (int i = 2; i < n * 4; i += 4)
    for (int j = 2, x; j < m * 4 && 1 == scanf("%d", &x); j += 4)
      c += x, s += 1LL * x * i, d += x, t += 1LL * x * j, u += 1LL * i * i * x,
          v += 1LL * j * j * x;
  long long w = u, z = v;
  for (int i = 0; i < n * 4; i += 4)
    if ((w += c * (i * 8 + 16) - s * 8) < u) u = w, p = i + 4;
  for (int i = 0; i < m * 4; i += 4)
    if ((z += d * (i * 8 + 16) - t * 8) < v) v = z, q = i + 4;
  cout << (u + v) << endl << (p / 4) << " " << (q / 4) << endl;
  return 0;
}
