{$o-,q+,r+}
uses
  sysutils, math;

const
  INF = 1000000000;

var
  n, m, i, j, l, r, t, b: integer;
  a: array[1..500, 1..500] of integer;
  q: array[1..500] of integer;
  mm, s, ss, maxs, maxt, maxb, maxl, maxr: integer;


begin
  reset(input, 'max.in');
  rewrite(output, 'max.out');

  read(n, m);
  for i := 1 to n do begin
    for j := 1 to m do begin
      read(a[i, j]);
    end;
  end;

  maxs := -INF;
  for l := 1 to m do begin
    for i := 1 to n do q[i] := a[i, l];
    for r := l + 1 to m do begin
      for i := 1 to n do q[i] := q[i] + a[i, r];
      t := 0;
      mm := -INF;
      s := 0;
      for b := 1 to n do begin
        ss := s + q[b] + mm;
        if (ss > maxs) then begin
          maxs := ss;
          maxl := l;
          maxr := r;
          maxb := b;
          maxt := t;
        end;
        ss := -s + q[b] - a[b, l] - a[b, r];
        if (ss > mm) then begin
          mm := ss;
          t := b;
        end;
        s := s + a[b, l] + a[b, r];
      end;
    end;
  end;

  writeln(maxs);
  writeln(maxt, ' ', maxl, ' ', maxb, ' ', maxr);

end.