#include <bits/stdc++.h>
using namespace std;
const int maxN = 1005;
int n, m;
int a[maxN][maxN];
long long sumRow[maxN];
long long sumCol[maxN];
long long fx[maxN];
long long fy[maxN];
void readFile() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
}
void init() {
  for (int i = 1; i <= n; i++) {
    sumRow[i] = 0;
    for (int j = 1; j <= m; j++) sumRow[i] += a[i][j];
  }
  for (int i = 1; i <= m; i++) {
    sumCol[i] = 0;
    for (int j = 0; j <= n; j++) sumCol[i] += a[j][i];
  }
  for (int i = 0; i <= n; i++) {
    fx[i] = 0;
    for (int j = 1; j <= n; j++)
      fx[i] += (long long)(4 * i - (4 * j - 2)) *
               (long long)(4 * i - (4 * j - 2)) * sumRow[j];
  }
  for (int j = 0; j <= m; j++) {
    fy[j] = 0;
    for (int i = 1; i <= m; i++)
      fy[j] += (long long)(4 * j - (4 * i - 2)) *
               (long long)(4 * j - (4 * i - 2)) * sumCol[i];
  }
}
int main() {
  readFile();
  init();
  long long res = 1000111000111000111LL;
  long long res_x, res_y;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      long long sum = fx[i] + fy[j];
      if (sum < res) {
        res = sum;
        res_x = i;
        res_y = j;
      }
    }
  cout << res << endl;
  cout << res_x << " " << res_y << endl;
}
