#include <bits/stdc++.h>
long n, m;
long sx[1000], sy[1000];
inline long long distance2(long cell, long line) {
  return (((cell - line) * 4 + 2) * ((cell - line) * 4 + 2));
}
int main() {
  memset(sx, 0, sizeof(sx));
  memset(sy, 0, sizeof(sy));
  std::cin >> n >> m;
  for (long row = 0; row < n; ++row) {
    for (long cell = 0; cell < m; ++cell) {
      long value;
      std::cin >> value;
      sx[row] += value;
      sy[cell] += value;
    }
  }
  long min_line_y = std::numeric_limits<long>::max();
  long long min_total_y = std::numeric_limits<long long>::max();
  for (long line_y = 0; line_y <= n; ++line_y) {
    long long total = 0;
    for (long cell_y = 0; cell_y < n; ++cell_y) {
      total += distance2(cell_y, line_y) * sx[cell_y];
    }
    if (total < min_total_y) {
      min_total_y = total;
      min_line_y = line_y;
    }
  }
  long min_line_x = std::numeric_limits<long>::max();
  long long min_total_x = std::numeric_limits<long long>::max();
  for (long line_x = 0; line_x <= m; ++line_x) {
    long long total = 0;
    for (long cell_x = 0; cell_x < m; ++cell_x) {
      total += distance2(cell_x, line_x) * sy[cell_x];
    }
    if (total < min_total_x) {
      min_total_x = total;
      min_line_x = line_x;
    }
  }
  std::cout << min_total_y + min_total_x << std::endl;
  std::cout << min_line_y << ' ' << min_line_x << std::endl;
}
