#include <bits/stdc++.h>
using namespace std;
long long a[1010][1010], b[4][1010][1010], c[4][1010][1010], d[4][1010][1010],
    e[4][1010][1010], f[4][1010][1010], g[4][1010][1010], cd[4][1010][1010];
long long ans, temp;
int n, m, i, j, x, y;
void calc(int k, int di, int dj, int si, int ei, int sj, int ej) {
  for (i = si; i != ei; i += di)
    for (j = sj; j != ej; j += dj) {
      b[k][i][j] = b[k][i][j - dj] + a[i][j];
      c[k][i][j] = c[k][i - di][j] + b[k][i][j];
      e[k][i][j] = e[k][i][j - dj] + 4 * b[k][i][j - dj] + 2 * a[i][j];
      d[k][i][j] = d[k][i][j - dj] + 8 * e[k][i][j - dj] +
                   16 * b[k][i][j - dj] + 4 * a[i][j];
      g[k][i][j] = g[k][i - di][j] + d[k][i][j];
      cd[k][i][j] = cd[k][i - di][j] + 4 * c[k][i - di][j] + 2 * b[k][i][j];
      f[k][i][j] = f[k][i - di][j] + 8 * cd[k][i - di][j] +
                   16 * c[k][i - di][j] + 4 * b[k][i][j];
    }
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%I64d", &a[i][j]);
  calc(0, 1, 1, 1, n + 1, 1, m + 1);
  calc(1, 1, -1, 1, n + 1, m, 0);
  calc(2, -1, 1, n, 0, 1, m + 1);
  calc(3, -1, -1, n, 0, m, 0);
  ans = 1e60;
  for (i = 0; i <= n; i++)
    for (j = 0; j <= m; j++) {
      temp = g[0][i][j] + g[1][i][j + 1] + g[2][i + 1][j] + g[3][i + 1][j + 1] +
             f[0][i][j] + f[1][i][j + 1] + f[2][i + 1][j] + f[3][i + 1][j + 1];
      if (temp < ans || temp == ans && i < x || temp == ans && i == x && j < y)
        ans = temp, x = i, y = j;
    }
  cout << ans << endl;
  cout << x << ' ' << y << endl;
  return 0;
}
