#include <bits/stdc++.h>
using namespace std;
int n, m;
long long C[1010][1010];
long long sum_col[1010], sum_row[1010];
long long ans_row[1010], ans_col[1010];
int main() {
  cin >> n >> m;
  memset(sum_col, 0, sizeof(sum_col));
  memset(sum_row, 0, sizeof(sum_row));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%I64d", &C[i][j]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) sum_row[i] += C[i][j];
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) sum_col[i] += C[j][i];
  for (int i = 0; i <= n; i++) {
    ans_row[i] = 0;
    for (int j = 1; j <= n; j++)
      ans_row[i] +=
          sum_row[j] * ((abs((long long)i * 4LL - (long long)j * 4LL + 2LL)) *
                        (abs((long long)i * 4LL - (long long)j * 4LL + 2LL)));
  }
  for (int i = 0; i <= m; i++) {
    ans_col[i] = 0;
    for (int j = 1; j <= m; j++)
      ans_col[i] +=
          sum_col[j] * ((abs((long long)i * 4LL - (long long)j * 4LL + 2LL)) *
                        (abs((long long)i * 4LL - (long long)j * 4LL + 2LL)));
  }
  long long ans = 1000000000000000000LL;
  int x, y;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      if (ans_row[i] + ans_col[j] < ans)
        ans = ans_row[i] + ans_col[j], x = i, y = j;
  cout << ans << endl;
  cout << x << " " << y << endl;
  return 0;
}
