//============================================================================
// Name        : CF.cpp
// Author      : Mahmoud A.Gawad(RED_JOHN_G)
// Version     :
// Copyright   : This code is free to use.
//                You have the right to reuse/modify it.
// Description : Codeforces Rounds in C++
//============================================================================
#include <bits/stdc++.h> // Magic goes here! ;)
using namespace std;

typedef long long ll;

#define mem(arr,val) memset(arr,val,sizeof arr)
#define loopi(i,val,n) for(i=val;i<=n;i++)
#define loopd(i,val,val2) for(i=val;i>=val2;i--)

#define sz(vec) (int)vec.size()
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%I64d",&n)
#define scl(n) scanf("%I64d",&n)
#define sc2(n,m) scanf("%d %d",&n,&m)
#define sc3(n,m,x) scanf("%d %d %d",&n,&m,&x)
#define sc4(n,m,x,y) scanf("%d %d %d %d",&n,&m,&x,&y)
#define println(n) printf("%d\n",n)
#define printlnl(n) printf("%I64d\n",n)
#define line() printf("\n")
#define print(n) printf("%d",n)
#define print2(n,m) printf("%d %d",n,m)
#define print1(n) printf(" %d",n)
#define prints(s) printf("%s",s)

typedef vector<int> vi;
typedef pair<int, int> pr;
typedef vector<pr> vpr;

int i, j, k;

void A();
void B();
void C();
void D();
void E();

int main() {
    C();
    return 0;
}

ll arr[2000][2000], x[2][2000], y[2][2000];
int n;

void prnt() {
    printf("=======================\n");
    for (int i = 0; i < n; i++) {
        printf("%I64d %I64d %I64d %I64d\n", x[0][i], x[1][i], y[0][i], y[1][i]);
    }
    printf("++++++++++++++++++++++++\n");
}

void solve(int ii, ll& Max, int& ax, int& ay, bool flag) { // exclude position (ex, ey)

    int ix, iy; // intersected point.
    // eqn: y = x (-/+) i;
    for (int i = 0; i < n; i++) {

        if (x[ii][i] == -1)
            continue;

        // eqn: y = -x + (n-1-j);
        for (int j = 0; j < n; j++) {

            if (y[0][j] == -1)
                continue;

            ix = (ii ? -i : i) + (n - 1 - j);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - (ii ? -i : i);
                if(iy>=0&&iy<n&&ix<n)
                if (Max < x[ii][i] + y[0][j] - arr[ix][iy]) {
                    Max = x[ii][i] + y[0][j] - arr[ix][iy];
                    ax = ix, ay = iy;
                }

            }
        }

        // eqn: y = -x + (n+k-1);
        for (int k = 0; k < n; k++) {

            if (y[1][k] == -1)
                continue;

            ix = (ii ? -i : i) + (n + k - 1);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - (ii ? -i : i);
                if(iy>=0&&iy<n&&ix<n)
                if (Max < x[ii][i] + y[1][k] - arr[ix][iy]) {
                    Max = x[ii][i] + y[1][k] - arr[ix][iy];
                    ax = ix, ay = iy;
                }
            }
        }
    }
//  printf("%d %d\n", ax, ay);
    if (flag) {

        int yy;
        x[0][yy = abs(ax - ay)] = -1;
        int cx, cy;
        y[cx = n - ax - 1 >= ay ? 0 : 1][cy = abs(n - ax - 1 - ay)] = -1;
        int zz = (cx ? -cy-1 : cy+1);
//      printf("%d %d %d %d\n",0,yy,cx,cy);
        for (int i = 0; i < n; i++) {
            int xx = i + zz;
            if (xx<n&&xx >= 0 && xx % 2 == 0&&(xx/2-i)>=0&&(xx/2-i)<n)
                x[0][i] = -1;

            xx = -i + zz;
            if (xx<n&&xx >= 0 && xx % 2 == 0&&(xx/2+i)>=0&&(xx/2+i)<n)
                x[1][i] = -1;

        }

        for (int i = 0; i < n; i++) {
            int xx = yy + (n-1-i);
            if (xx<n&&xx >= 0 && xx % 2 == 0&&(xx/2-i)>=0&&(xx/2-i)<n)
                y[0][i] = -1;
            xx = yy + i+n-1;
            if (xx<n&&xx >= 0 && xx % 2 == 0&&(xx/2+i)>=0&&(xx/2+i)<n)
                y[1][i] = -1;

        }
//      prnt();

    }

}

pair<ll, pair<int, int> > put_bishop() {
    int ax, ay;
    ll Max = -1;
    solve(0, Max, ax, ay,0);
    solve(1, Max, ax, ay,1);
    return make_pair(Max, make_pair(ax + 1, ay + 1));
}

void C() {
    sc(n);
    for (int i = 0; i < n; i++)
        x[0][i] = x[1][i] = y[0][i] = y[1][i] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scl(arr[i][j]);
            x[i >= j ? 0 : 1][abs(j - i)] += arr[i][j];
            y[n - i - 1 >= j ? 0 : 1][abs(n - i - 1 - j)] += arr[i][j];
        }
    }
//  for (int i = 0; i < n; i++) {
//      printf("%I64d %I64d %I64d %I64d\n",x[0][i],x[1][i],y[0][i],y[1][i]);
//  }
//  return;
    pair<ll, pair<int, int> > a, b;
    a = put_bishop();
    b = put_bishop();
    printlnl(a.first + b.first);
    printf("%d %d %d %d\n", a.second.first, a.second.second, b.second.first,
            b.second.second);
}


//============================================================================
// Name        : CF.cpp
// Author      : Mahmoud A.Gawad(RED_JOHN_G)
// Version     :
// Copyright   : This code is free to use.
//                You have the right to reuse/modify it.
// Description : Codeforces Rounds in C++
//============================================================================
#include <bits/stdc++.h> // Magic goes here! ;)
using namespace std;

typedef long long ll;

#define mem(arr,val) memset(arr,val,sizeof arr)
#define loopi(i,val,n) for(i=val;i<=n;i++)
#define loopd(i,val,val2) for(i=val;i>=val2;i--)

#define sz(vec) (int)vec.size()
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%I64d",&n)
#define scl(n) scanf("%I64d",&n)
#define sc2(n,m) scanf("%d %d",&n,&m)
#define sc3(n,m,x) scanf("%d %d %d",&n,&m,&x)
#define sc4(n,m,x,y) scanf("%d %d %d %d",&n,&m,&x,&y)
#define println(n) printf("%d\n",n)
#define printlnl(n) printf("%I64d\n",n)
#define line() printf("\n")
#define print(n) printf("%d",n)
#define print2(n,m) printf("%d %d",n,m)
#define print1(n) printf(" %d",n)
#define prints(s) printf("%s",s)

typedef vector<int> vi;
typedef pair<int, int> pr;
typedef vector<pr> vpr;

int i, j, k;

void A();
void B();
void C();
void D();
void E();

int main() {
    C();
    return 0;
}

ll arr[2000][2000], x[2][2000], y[2][2000];
int n;

void prnt() {
    printf("=======================\n");
    for (int i = 0; i < n; i++) {
        printf("%I64d %I64d %I64d %I64d\n", x[0][i], x[1][i], y[0][i], y[1][i]);
    }
    printf("++++++++++++++++++++++++\n");
}

void solve(int ii, ll& Max, int& ax, int& ay, bool flag) { // exclude position (ex, ey)

    int ix, iy; // intersected point.
    // eqn: y = x (-/+) i;
    for (int i = 0; i < n; i++) {

        if (x[ii][i] == -1)
            continue;

        // eqn: y = -x + (n-1-j);
        for (int j = 0; j < n; j++) {

            if (y[0][j] == -1)
                continue;

            ix = (ii ? -i : i) + (n - 1 - j);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - (ii ? -i : i);
                if(iy>=0&&iy<n&&ix<n)
                if (Max < x[ii][i] + y[0][j] - arr[ix][iy]) {
                    Max = x[ii][i] + y[0][j] - arr[ix][iy];
                    ax = ix, ay = iy;
                }

            }
        }

        // eqn: y = -x + (n+k-1);
        for (int k = 0; k < n; k++) {

            if (y[1][k] == -1)
                continue;

            ix = (ii ? -i : i) + (n + k - 1);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - (ii ? -i : i);
                if(iy>=0&&iy<n&&ix<n)
                if (Max < x[ii][i] + y[1][k] - arr[ix][iy]) {
                    Max = x[ii][i] + y[1][k] - arr[ix][iy];
                    ax = ix, ay = iy;
                }
            }
        }
    }
//  printf("%d %d\n", ax, ay);
    if (flag) {

        int yy;
        x[0][yy = abs(ax - ay)] = -1;
        int cx, cy;
        y[cx = n - ax - 1 >= ay ? 0 : 1][cy = abs(n - ax - 1 - ay)] = -1;
        int zz = (cx ? -cy-1 : cy+1);
//      printf("%d %d %d %d\n",0,yy,cx,cy);
        for (int i = 0; i < n; i++) {
            int xx = i + zz;
            if (xx >= 0 && xx % 2 == 0)
                x[0][i] = -1;

            xx = -i + zz;
            if (xx >= 0 && xx % 2 == 0)
                x[1][i] = -1;

        }

        for (int i = 0; i < n; i++) {
            int xx = yy + i;
            if (xx >= 0 && xx % 2 == 0)
                y[0][n-1-i] = -1;
            xx = yy + i+n-1;
            if (xx >= 0 && xx % 2 == 0)
                y[1][i] = -1;

        }
//      prnt();

    }

}

pair<ll, pair<int, int> > put_bishop() {
    int ax, ay;
    ll Max = -1;
    solve(0, Max, ax, ay,0);
    solve(1, Max, ax, ay,1);
    return make_pair(Max, make_pair(ax + 1, ay + 1));
}

void C() {
    sc(n);
    for (int i = 0; i < n; i++)
        x[0][i] = x[1][i] = y[0][i] = y[1][i] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scl(arr[i][j]);
            x[i >= j ? 0 : 1][abs(j - i)] += arr[i][j];
            y[n - i - 1 >= j ? 0 : 1][abs(n - i - 1 - j)] += arr[i][j];
        }
    }
//  for (int i = 0; i < n; i++) {
//      printf("%I64d %I64d %I64d %I64d\n",x[0][i],x[1][i],y[0][i],y[1][i]);
//  }
//  return;
    pair<ll, pair<int, int> > a, b;
    a = put_bishop();
    b = put_bishop();
    printlnl(a.first + b.first);
    printf("%d %d %d %d\n", a.second.first, a.second.second, b.second.first,
            b.second.second);
}


//============================================================================
// Name        : CF.cpp
// Author      : Mahmoud A.Gawad(RED_JOHN_G)
// Version     :
// Copyright   : This code is free to use.
//                You have the right to reuse/modify it.
// Description : Codeforces Rounds in C++
//============================================================================
#include <bits/stdc++.h> // Magic goes here! ;)
using namespace std;

typedef long long ll;

#define mem(arr,val) memset(arr,val,sizeof arr)
#define loopi(i,val,n) for(i=val;i<=n;i++)
#define loopd(i,val,val2) for(i=val;i>=val2;i--)

#define sz(vec) (int)vec.size()
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%I64d",&n)
#define scl(n) scanf("%I64d",&n)
#define sc2(n,m) scanf("%d %d",&n,&m)
#define sc3(n,m,x) scanf("%d %d %d",&n,&m,&x)
#define sc4(n,m,x,y) scanf("%d %d %d %d",&n,&m,&x,&y)
#define println(n) printf("%d\n",n)
#define printlnl(n) printf("%I64d\n",n)
#define line() printf("\n")
#define print(n) printf("%d",n)
#define print2(n,m) printf("%d %d",n,m)
#define print1(n) printf(" %d",n)
#define prints(s) printf("%s",s)

typedef vector<int> vi;
typedef pair<int, int> pr;
typedef vector<pr> vpr;

int i, j, k;

void A();
void B();
void C();
void D();
void E();

int main() {
    C();
    return 0;
}

ll arr[2000][2000], x[2][2000], y[2][2000];
int n;

void prnt() {
    printf("=======================\n");
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++)
            printf("%I64d ", arr[i][j]);
        line();
    }
}

void solve(int ii, ll& Max, int& ax, int& ay) { // exclude position (ex, ey)

    int ix, iy; // intersected point.

    // eqn: y = x (-/+) i;
    for (int i = 0; i < n; i++) {

        if (x[ii][i] == -1)
            continue;

        // eqn: y = -x - (n-1-j);
        for (int j = 0; j < n; j++) {

            if (y[0][j] == -1)
                continue;

            ix = (ii ? -i : i) + (n - 1 - j);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - (ii ? -i : i);
                if (iy >= 0) {
                    if (Max < x[ii][i] + y[0][j] - arr[ix][iy]) {
                        Max = x[ii][i] + y[0][j] - arr[ix][iy];
                        ax = ix, ay = iy;
                    }
                }
            }
        }

        // eqn: y = -x + (n+k-1);
        for (int k = 0; k < n; k++) {

            if (y[1][k] == -1)
                continue;

            ix = (ii ? -i : i) + (n + k - 1);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - (ii ? -i : i);
                if (iy >= 0 && x[ii][i] != -1 && y[1][k] != -1) {
                    if (Max < x[ii][i] + y[1][k] - arr[ix][iy]) {
                        Max = x[ii][i] + y[1][k] - arr[ix][iy];
                        ax = ix, ay = iy;
                    }
                }
            }
        }
    }

    x[ii][abs(ax - ay)] = -1;
    int cx, cy;
    y[cx = n - ax - 1 >= ay ? 0 : 1][cy = abs(n - ax - 1 - ay)] = -1;

    for (int i = 0; i < n; i++) {
        int xx = (ii ? -i : i) - (n - 1 + (cx ? -cy : cy));
        if (xx >= 0 && xx % 2 == 0&&(xx/2 - (ii?-i:i))>=0)
            x[ii][i] = -1;

    }

    for (int i = 0; i < n; i++) {
        int xx = (ii ? -abs(ax-ay) : abs(ax-ay)) - (n - 1 + (cx ? -i : i));
        if (xx >= 0 && xx % 2 == 0&&(xx/2 - (ii?-abs(ax-ay):abs(ax-ay)))>=0)
            y[cx][i] = -1;

    }

}

pair<ll, pair<int, int> > put_bishop() {
    int ax, ay;
    ll Max = -1;
    solve(0, Max, ax, ay);
    solve(1, Max, ax, ay);
    return make_pair(Max, make_pair(ax + 1, ay + 1));
}

void C() {
    sc(n);
    for (int i = 0; i < n; i++)
        x[0][i] = x[1][i] = y[0][i] = y[1][i] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scl(arr[i][j]);
            x[i >= j ? 0 : 1][abs(j - i)] += arr[i][j];
            y[n - i - 1 >= j ? 0 : 1][abs(n - i - 1 - j)] += arr[i][j];
        }
    }
//  for (int i = 0; i < n; i++) {
//      printf("%I64d %I64d %I64d %I64d\n",x[0][i],x[1][i],y[0][i],y[1][i]);
//  }
//  return;
    pair<ll, pair<int, int> > a, b;
    a = put_bishop();
    b = put_bishop();
    printlnl(a.first + b.first);
    printf("%d %d %d %d\n", a.second.first, a.second.second, b.second.first,
            b.second.second);
}


//============================================================================
// Name        : CF.cpp
// Author      : Mahmoud A.Gawad(RED_JOHN_G)
// Version     :
// Copyright   : This code is free to use.
//                You have the right to reuse/modify it.
// Description : Codeforces Rounds in C++
//============================================================================
#include <bits/stdc++.h> // Magic goes here! ;)
using namespace std;

typedef long long ll;

#define mem(arr,val) memset(arr,val,sizeof arr)
#define loopi(i,val,n) for(i=val;i<=n;i++)
#define loopd(i,val,val2) for(i=val;i>=val2;i--)

#define sz(vec) (int)vec.size()
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%I64d",&n)
#define scl(n) scanf("%I64d",&n)
#define sc2(n,m) scanf("%d %d",&n,&m)
#define sc3(n,m,x) scanf("%d %d %d",&n,&m,&x)
#define sc4(n,m,x,y) scanf("%d %d %d %d",&n,&m,&x,&y)
#define println(n) printf("%d\n",n)
#define printlnl(n) printf("%I64d\n",n)
#define line() printf("\n")
#define print(n) printf("%d",n)
#define print2(n,m) printf("%d %d",n,m)
#define print1(n) printf(" %d",n)
#define prints(s) printf("%s",s)

typedef vector<int> vi;
typedef pair<int, int> pr;
typedef vector<pr> vpr;

int i, j, k;

void A();
void B();
void C();
void D();
void E();

int main() {
    C();
    return 0;
}

int n;
ll arr[2000][2000], x[2][2000], y[2][2000];

pair<ll, pair<int, int> > put_bishop() {
    pair<ll, pair<int, int> > ans;

    ll Max = -1;
    pr p, f, s;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ll xx = x[i >= j ? 0 : 1][abs(i - j)];
            ll yy = y[n - i - 1 >= j ? 0 : 1][abs(n - 1 - i - j)];

            if (xx != -1 && yy != -1) {
                if (xx + yy - arr[i][j] > Max) {

                    Max = xx + yy - arr[i][j];
                    p = make_pair(i, j);
                    f = make_pair(i >= j ? abs(j - i) : 0,
                            i >= j ? 0 : abs(j - i));
                    s = make_pair(n - i - 1 >= j ? 0 : max(0, i - (n-1-j)),
                            n - i - 1 >= j ? min(n - 1, i + j) : n - 1);
                }
            }
        }
    }
//  printf("%d %d - %d %d %d %d\n", p.first,p.second,f.first,f.second,s.first,s.second);
    for (int i = f.first, j = f.second; i < n; i++, j++) {
        int xx = n - i - 1 >= j ? 0 : 1;
        int yy = abs(n - 1 - i - j);
        y[xx][yy] = -1;
    }

    for (int i = s.first, j = s.second; i < n; i++, j--) {
        int xx = i >= j ? 0 : 1;
        int yy = abs(j - i);
        x[xx][yy] = -1;
    }

    return make_pair(Max, p);
}

void C() {
    sc(n);
    for (int i = 0; i < n; i++)
        x[0][i] = x[1][i] = y[0][i] = y[1][i] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scl(arr[i][j]);
            x[i >= j ? 0 : 1][abs(j - i)] += arr[i][j];
            y[n - i - 1 >= j ? 0 : 1][abs(n - i - 1 - j)] += arr[i][j];
        }
    }
    pair<ll, pair<int, int> > a, b;
    a = put_bishop();
    b = put_bishop();
    printlnl(a.first + b.first);
    printf("%d %d %d %d\n", a.second.first + 1, a.second.second + 1,
            1 + b.second.first, b.second.second + 1);
}


//============================================================================
// Name        : CF.cpp
// Author      : Mahmoud A.Gawad(RED_JOHN_G)
// Version     :
// Copyright   : This code is free to use.
//                You have the right to reuse/modify it.
// Description : Codeforces Rounds in C++
//============================================================================
#include <bits/stdc++.h> // Magic goes here! ;)
using namespace std;

typedef long long ll;

#define mem(arr,val) memset(arr,val,sizeof arr)
#define loopi(i,val,n) for(i=val;i<=n;i++)
#define loopd(i,val,val2) for(i=val;i>=val2;i--)

#define sz(vec) (int)vec.size()
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%I64d",&n)
#define scl(n) scanf("%I64d",&n)
#define sc2(n,m) scanf("%d %d",&n,&m)
#define sc3(n,m,x) scanf("%d %d %d",&n,&m,&x)
#define sc4(n,m,x,y) scanf("%d %d %d %d",&n,&m,&x,&y)
#define println(n) printf("%d\n",n)
#define printlnl(n) printf("%I64d\n",n)
#define line() printf("\n")
#define print(n) printf("%d",n)
#define print2(n,m) printf("%d %d",n,m)
#define print1(n) printf(" %d",n)
#define prints(s) printf("%s",s)

typedef vector<int> vi;
typedef pair<int, int> pr;
typedef vector<pr> vpr;

int i, j, k;

void A();
void B();
void C();
void D();
void E();

int main() {
    C();
    return 0;
}

int n;
ll arr[2000][2000], x[2][2000], y[2][2000];

pair<ll, pair<int, int> > put_bishop() {
    pair<ll, pair<int, int> > ans;

    ll Max = -1;
    pr p, f, s;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ll xx = x[i >= j ? 0 : 1][abs(i - j)];
            ll yy = y[n - i - 1 >= j ? 0 : 1][abs(n - 1 - i - j)];

            if (xx != -1 && yy != -1) {
                if (xx + yy - arr[i][j] > Max) {

                    Max = xx + yy - arr[i][j];
                    p = make_pair(i, j);
                    f = make_pair(i >= j ? abs(j - i) : 0,
                            i >= j ? 0 : abs(j - i));
                    s = make_pair(n - i - 1 >= j ? 0 : min(n - 1, i + j),
                            n - i - 1 >= j ? min(n - 1, i + j) : n - 1);
                }
            }
        }
    }
    for (int i = f.first, j = f.second; i < n; i++, j++) {
        int xx = n - i - 1 >= j ? 0 : 1;
        int yy = abs(n - 1 - i - j);
        y[xx][yy] = -1;
    }

    for (int i = s.first, j = s.second; i < n; i++, j--) {
        int xx = i >= j ? 0 : 1;
        int yy = abs(j - i);
        x[xx][yy] = -1;
    }

    return make_pair(Max, p);
}

void C() {
    sc(n);
    for (int i = 0; i < n; i++)
        x[0][i] = x[1][i] = y[0][i] = y[1][i] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scl(arr[i][j]);
            x[i >= j ? 0 : 1][abs(j - i)] += arr[i][j];
            y[n - i - 1 >= j ? 0 : 1][abs(n - i - 1 - j)] += arr[i][j];
        }
    }
    pair<ll, pair<int, int> > a, b;
    a = put_bishop();
    b = put_bishop();
    printlnl(a.first + b.first);
    printf("%d %d %d %d\n", a.second.first + 1, a.second.second + 1,
            1 + b.second.first, b.second.second + 1);
}


//============================================================================
// Name        : CF.cpp
// Author      : Mahmoud A.Gawad(RED_JOHN_G)
// Version     :
// Copyright   : This code is free to use.
//                You have the right to reuse/modify it.
// Description : Codeforces Rounds in C++
//============================================================================
#include <bits/stdc++.h> // Magic goes here! ;)
using namespace std;

typedef long long ll;

#define mem(arr,val) memset(arr,val,sizeof arr)
#define loopi(i,val,n) for(i=val;i<=n;i++)
#define loopd(i,val,val2) for(i=val;i>=val2;i--)

#define sz(vec) (int)vec.size()
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%I64d",&n)
#define scl(n) scanf("%I64d",&n)
#define sc2(n,m) scanf("%d %d",&n,&m)
#define sc3(n,m,x) scanf("%d %d %d",&n,&m,&x)
#define sc4(n,m,x,y) scanf("%d %d %d %d",&n,&m,&x,&y)
#define println(n) printf("%d\n",n)
#define printlnl(n) printf("%I64d\n",n)
#define line() printf("\n")
#define print(n) printf("%d",n)
#define print2(n,m) printf("%d %d",n,m)
#define print1(n) printf(" %d",n)
#define prints(s) printf("%s",s)

typedef vector<int> vi;
typedef pair<int, int> pr;
typedef vector<pr> vpr;

int i, j, k;

void A();
void B();
void C();
void D();
void E();

int main() {
    C();
    return 0;
}

ll arr[2000][2000], x[2][2000], y[2][2000];
int n;

void prnt() {
    printf("=======================\n");
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++)
            printf("%I64d ", arr[i][j]);
        line();
    }
}

void solve(int ii, ll& Max, int& ax, int& ay) { // exclude position (ex, ey)

    int ix, iy; // intersected point.

    // eqn: y = x (-/+) i;
    for (int i = 0; i < n; i++) {

        // eqn: y = -x - (n-1-j);
        for (int j = 0; j < n; j++) {
            ix = (ii ? -i : i) + (n - 1 - j);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - i;
                if (iy >= 0 && x[ii][i] != -1&&y[0][j]!=-1) {
                    if (Max < x[ii][i] + y[0][j] - arr[ix][iy]) {
                        Max = x[ii][i] + y[0][j] - arr[ix][iy];
                        ax = ix, ay = iy;
                    }
                }
            }
        }

        // eqn: y = -x + (n+k-1);
        for (int k = 0; k < n; k++) {
            ix = (ii ? -i : i) + (n + k - 1);
            if (ix >= 0 && ix % 2 == 0) {
                ix /= 2;
                iy = ix - i;
                if (iy >= 0 && x[ii][i] != -1 && y[1][k]!=-1) {
                    if (Max < x[ii][i] + y[1][k] - arr[ix][iy]) {
                        Max = x[ii][i] + y[1][k] - arr[ix][iy];
                        ax = ix, ay = iy;
                    }
                }
            }
        }
    }

    x[ii][abs(ax - ay)] = -1;
    y[n - ax - 1 >= ay?0:1][abs(n - ax - 1 - ay)] = -1;

}

pair<ll, pair<int, int> > put_bishop() {
    int ax, ay;
    ll Max = -1;
    solve(0, Max, ax, ay);
    solve(1, Max, ax, ay);
    return make_pair(Max, make_pair(ax + 1, ay + 1));
}

void C() {
    sc(n);
    for (int i = 0; i < n; i++)
        x[0][i] = x[1][i] = y[0][i] = y[1][i] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scl(arr[i][j]);
            x[i >= j?0:1][abs(j - i)] += arr[i][j];
            y[n - i - 1 >= j?0:1][abs(n - i - 1 - j)] += arr[i][j];
        }
    }
//  for (int i = 0; i < n; i++) {
//      printf("%I64d %I64d %I64d %I64d\n",x[0][i],x[1][i],y[0][i],y[1][i]);
//  }
//  return;
    pair<ll, pair<int, int> > a, b;
    a = put_bishop();
    b = put_bishop();
    printlnl(a.first + b.first);
    printf("%d %d %d %d\n", a.second.first, a.second.second, b.second.first,
            b.second.second);
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005];
struct abc
{
    ll point , x , y ;
}I ;
vector < abc > Ans ;
ll dp[2005][2005];
bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    cin >> n ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) cin >> inp[i][j] ;
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
             I.x = i ;
             I.y = j ;
             I.point = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
             Ans.pb(I);

            //idx++;
        }
    }
    sort(Ans.begin(),Ans.end(),cmp);

    ll Res = Ans[0].point ;
    for ( i = 1 ; i < idx ; i++ )
    {
        if ( (Ans[0].x+Ans[0].y)%2 != (Ans[i].x+Ans[i].y)%2 )
        {
            Res += Ans[i].point ;
            break;
        }
    }
    cout <<Res<<endl ;
    cout<<Ans[0].x<<" "<<Ans[0].y<<" "<<Ans[i].x<<" "<<Ans[i].y<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];

int n ;
int main()
{
    int i , j , k;
    scanf("%d",n);
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) scanf("%I64d",&inp[i][j]);
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
         for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }

    int idx = 0 ;
      ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;

    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
              if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }

            //idx++;
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];
struct abc
{
    ll point;
    int x , y ;
}I ;
vector < abc > Ans ;

bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    scanf("%d",&n);
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) scanf("%I64",&inp[i][j]) ;
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);

            //idx++;
        }
    }

    ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];

int n ;
int main()
{
    int i , j , k;
    read(n);
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) cin >> inp[i][j] ;
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
         for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }

    int idx = 0 ;
      ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;

    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
              if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }

            //idx++;
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];

int n ;
int main()
{
    int i , j , k;
    scanf("%d",&n);
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) scanf("%I64d",&inp[i][j]);
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
         for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }

    int idx = 0 ;
      ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;

    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
              if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }

            //idx++;
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005];
struct abc
{
    ll point , x , y ;
}Ans[50000005];
ll dp[2005][2005];
bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    cin >> n ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) cin >> inp[i][j] ;
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            Ans[idx].x = i ;
            Ans[idx].y = j ;
            Ans[idx].point = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
          //  printf("dwL :: %lld dwR:: %lld upL :: %lld upR:: %lld inp :: %lld tot :: %lld \n",dwL[i][j] , dwR[i][j], upL[i][j], upR[i][j],inp[i][j] ,  Ans[idx].point );
            idx++;
        }
    }
    sort(Ans,Ans+idx,cmp);
   /* for ( i = 0 ; i < idx ; i++ )
    {
        cout<<Ans[i].x << " "<<Ans[i].y << " "<< " poin " << Ans[i].point << endl;
    } */
    ll Res = Ans[0].point ;
    for ( i = 1 ; i < idx ; i++ )
    {
        if ( (Ans[0].x+Ans[0].y)%2 != (Ans[i].x+Ans[i].y)%2 )
        {
            Res += Ans[i].point ;
            break;
        }
    }
    cout <<Res<<endl ;
    cout<<Ans[0].x<<" "<<Ans[0].y<<" "<<Ans[i].x<<" "<<Ans[i].y<<endl;
    return 0;
}


//BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];
struct abc
{
    ll point;
    int x , y ;
}I ;
vector < abc > Ans ;

bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    cin >> n ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) read(inp[i][j]);
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);

            //idx++;
        }
    }

    ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];

int n ;
int main()
{
    int i , j , k;
    scanf("%d",n);
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) scanf("%lld",&inp[i][j]);
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
         for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }

    int idx = 0 ;
      ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;

    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
              if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }

            //idx++;
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005];
struct abc
{
    ll point , x , y ;
}I ;
vector < abc > Ans ;
ll dp[2005][2005];
bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    cin >> n ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) cin >> inp[i][j] ;
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
             I.x = i ;
             I.y = j ;
             I.point = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
             Ans.pb(I);

            //idx++;
        }
    }
    sort(Ans.begin(),Ans.end(),cmp);

    ll Res = Ans[0].point ;
    for ( i = 1 ; i < Ans.size() ; i++ )
    {
        if ( (Ans[0].x+Ans[0].y)%2 != (Ans[i].x+Ans[i].y)%2 )
        {
            Res += Ans[i].point ;
            break;
        }
    }
    cout <<Res<<endl ;
    cout<<Ans[0].x<<" "<<Ans[0].y<<" "<<Ans[i].x<<" "<<Ans[i].y<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];

int n ;
int main()
{
    int i , j , k;
    read(n);
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) read(inp[i][j]);
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
         for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }

    int idx = 0 ;
      ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;

    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
              if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }

            //idx++;
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];
struct abc
{
    ll point;
    int x , y ;
}I ;
vector < abc > Ans ;

bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    scanf("%d",&n);
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) read(inp[i][j]);
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);

            //idx++;
        }
    }

    ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];
struct abc
{
    ll point;
    int x , y ;
}I ;
vector < abc > Ans ;

bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    cin >> n ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) cin >> inp[i][j] ;
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);

            //idx++;
        }
    }

    ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


 //BISMILLAHIRRAHMANIRRAHIM
/*
 manus tar shopner soman boro
 Author :: Shakil Ahmed
.............AUST_CSE27.........
 prob   ::
 Type   ::
 verdict::
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <set>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <list>
#include <map>
#include <queue>
#include <sstream>
#include <utility>
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define ff first
#define LL long long
#define ss second
#define rep(i,n) for(i = 0; i < n; i++)
#define REP(i,n) for(i=n;i>=0;i--)
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define ROF(i,a,b) for(int i = a; i >= b; i--)
#define re return
#define QI queue<int>
#define SI stack<int>
#define pii pair <int,int>
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define memo(a,b) memset((a),(b),sizeof(a))
#define G() getchar()
#define MAX3(a,b,c) max(a,max(b,c))

double const EPS=3e-8;
using namespace std;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0){LL t=bigmod(p,e/2,M);return (T)((t*t)%M);}
    return (T)((LL)bigmod(p,e-1,M)*(LL)p)%M;
}

template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//Fast Reader
template<class T>inline bool read(T &x){int c=getchar();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; x*=sgn; return ~c;}

/* **************************************  My code start here ****************************************** */
typedef long long ll ;
ll inp[2005][2005] , upL[2005][2005] , upR[2005][2005] , dwL[2005][2005] , dwR[2005][2005] , dp[2005][2005];
struct abc
{
    ll point;
    int x , y ;
}I ;
vector < abc > Ans ;

bool cmp(abc A , abc B)
{
    if ( A.point == B.point )
    {
        if( A.x == B.x ) return A.y < B.y ;
        else return A.x < B.x ;
    }
    return A.point > B.point ;
}

int n ;
int main()
{
    int i , j , k;
    cin >> n ;
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ ) cin >> inp[i][j] ;
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            dwR[i][j] = ( dwR[i-1][j-1]+inp[i][j]);
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = 1 ; j <= n ; j++ )
        {
            upR[i][j] = inp[i][j]+upR[i+1][j-1];
        }
    }
    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            dwL[i][j]  = inp[i][j] + dwL[i-1][j+1];
        }
    }
    for ( i = n ; i >= 1 ; i-- )
    {
        for ( j = n ; j >= 1 ; j-- )
        {
            upL[i][j] = inp[i][j] + upL[i+1][j+1];
        }
    }
    int idx = 0 ;
      ll odd = -1 , even = -1 ;
    int oddx , oddy , evenx , eveny ;

    for ( i = 1 ; i <= n ; i++ )
    {
        for ( j = 1 ; j <= n ; j++ )
        {

             dp[i][j] = dwL[i][j]+dwR[i][j]+upL[i][j]+upR[i][j]-(3*inp[i][j]);
              if( (i+j)%2 == 0 )
            {
                if ( even ==-1 || even < dp[i][j] )
                {
                    even = dp[i][j] ;
                    evenx = i ;
                    eveny = j ;
                }
            }
            else
            {
                if(odd == -1 || odd < dp[i][j] )
                {
                    odd = dp[i][j] ;
                    oddx = i ;
                    oddy = j ;
                }
            }

            //idx++;
        }
    }

    cout <<even+odd<<endl ;
    cout<<evenx<<" "<<eveny<<" "<<oddx<<" "<<oddy<<endl;
    return 0;
}


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
int dpx[maxn][maxn];
int dpy[maxn][maxn];
int dfsa(int x,int y)
{
	int i,j;
	if(x==n||y==n){
		dpx[x][y]=mat[x][y];
		return dpx[x][y];
	}
	else{
		dfsa(x+1,y+1);
		dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
		return dpx[x][y];
	}
}
int dfsb(int x,int y)
{
	int i,j;
	if(x==n||y==1){
		dpy[x][y]=mat[x][y];
		return dpy[x][y];
	}
	else{
		dfsb(x+1,y-1);
		dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
		return dpy[x][y];
	}
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&mat[i][j]);
		}
    }
    for(i=1;i<=n;i++){
		dfsa(i,1);
	    int fx=i;
	    int fy=1;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[i][1];
			fx++;
			fy++;
	    }
	}
    for(i=2;i<=n;i++){
		dfsa(1,i);
	    int fx=1;
	    int fy=i;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[1][i];
			fx++;
			fy++;
	    }
	}
    for(i=1;i<=n;i++){
		dfsb(i,n);
		int fx=i;
		int fy=n;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[i][n];
			fx++;
			fy--;
		}
    }
    for(i=n-1;i>0;i--){
		dfsb(1,i);
		int fx=1;
		int fy=i;
		while(fx!=n&&fy!=1){
			dpy[fx][fx]=dpy[1][i];
			fx++;
			fy--;
		}
    }
    int ans=0;
    int temp=0;
    int flag=0;
    int tx;
    int ty;
    int px;
    int py;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
				flag=(i+j)%2;
				tx=i;
				ty=j;
			}
		}
    }
    ans+=temp;
    temp=0;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp&&(i+j)%2!=flag){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
			    px=i;
			    py=j;
			}
		}
    }
    ans+=temp;
    printf("%d\n%d %d %d %d\n",ans,tx,ty,px,py);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#define pb push_back
using namespace std;
const long long NN=4001111;
long long f[2222][2222];
long long s1[4004];
long long s2[4004];
struct P{
    long long v;
    int i,j;
}sum[NN];
bool cmp(P s1,P s2){
    return s1.v>s2.v;
}
int main(){
    long long n;cin>>n;
    for(long long i=1;i<=n;i++)
        for(long long j=1;j<=n;j++){
            //cin>>f[i][j];
            scanf("%I64d",&f[i][j]);
            s1[i+j-1]+=f[i][j];
            s2[n+1-j+i-1]+=f[i][j];
        }
    for(long long i=1;i<=n;i++)
        for(long long j=1;j<=n;j++){
            long long id=(i-1)*n+j;
            sum[id].v=s1[i+j-1]+s2[n+1-j+i-1]-f[i][j];
            sum[id].i=i;
            sum[id].j=j;
        }
    long long ans1=-1,ans2=-1;
    long long ansx1=0,ansy1=0,ansx2=0,ansy2=0;
    for(long long i=1;i<=n*n;i++)
    {
        if((abs(sum[i].i+sum[i].j)&1)&&ans1<sum[i].v)
        {
            ans1=sum[i].v;
            ansx1=sum[i].i,ansy1=sum[i].j;
        }
        if(!(abs(sum[i].i+sum[i].j)&1) && ans2<sum[i].v)
        {
            ans2=sum[i].v;
            ansx2=sum[i].i,ansy2=sum[i].j;
        }
    }
    cout<<ans1+ans2<<endl;
    cout<<ansx1<<' '<<ansy1<<' ';
    cout<<ansx2<<' '<<ansy2<<endl;
}


#include<cstdio>
#include<cstring>
const int N = 2005;
typedef long long LL;
LL Map[N][N]; //棋盘
LL L[N*2]; //副对角线元素之和
LL R[N*2]; //主对角线元素之和
int main()
{
    int n;
    while(~scanf("%d",&n)) {
        memset(L, 0, sizeof(L));
        memset(R, 0, sizeof(R));
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                scanf("%I64d",&Map[i][j]);
                L[i+j] += Map[i][j]; //同一条副对角线i+j相同
                R[i-j+n] += Map[i][j]; //同一条主对角线i-j相同
            }
        }
        int x1 = 1, x2 = 1, y1 = 1, y2 = 2;
        LL max1 = 0, max2 = 0;
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                LL tmp = L[i+j] + R[i-j+n] - Map[i][j];
                if((i+j) % 2 == 0 && tmp > max1) {
                    max1 = tmp;
                    x1 = i;
                    y1 = j;
                }
                if((i + j) % 2 == 1 && tmp > max2) {
                    max2 = tmp;
                    x2 = i;
                    y2 = j;
                }
            }
        }
        printf("%I64d\n", max1 + max2);
        printf("%d %d %d %d\n", x1, y1, x2, y2);
    }
    return 0;


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
int dpx[maxn][maxn];
int dpy[maxn][maxn];
void dfsa(int x,int y)
{
	int i,j;
	if(x==n||y==n){
		dpx[x][y]=mat[x][y];
	}
	else{
		dfsa(x+1,y+1);
		dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
	}
	return;
}
void dfsb(int x,int y)
{
	int i,j;
	if(x==n||y==1){
		dpy[x][y]=mat[x][y];
	}
	else{
		dfsb(x+1,y-1);
		dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
	}
	return;
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&mat[i][j]);
		}
    }
    for(i=1;i<=n;i++){
		dfsa(i,1);
	    int fx=i;
	    int fy=1;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[i][1];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[i][1];
	}
    for(i=2;i<=n;i++){
		dfsa(1,i);
	    int fx=1;
	    int fy=i;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[1][i];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[1][i];
	}
    for(i=1;i<=n;i++){
		dfsb(i,n);
		int fx=i;
		int fy=n;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[i][n];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[i][n];
    }
    for(i=n-1;i>0;i--){
		dfsb(1,i);
		int fx=1;
		int fy=i;
		while(fx!=n&&fy!=1){
			dpy[fx][fx]=dpy[1][i];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[1][i];
    }
    int ans=0;
    int temp=0;
    int flag=0;
    int tx;
    int ty;
    int px;
    int py;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
				flag=(i+j)%2;
				tx=i;
				ty=j;
			}
		}
    }
    ans+=temp;
    int gt=temp;
    temp=0;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp&&(i+j)%2!=flag){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
			    px=i;
			    py=j;
			}
		}
    }
    ans+=temp;
    printf("%d\n%d %d %d %d\n",ans,tx,ty,px,py);
	return 0;
}


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
int dpx[maxn][maxn];
int dpy[maxn][maxn];
void dfsa(int x,int y)
{
	int i,j;
	if(x==n||y==n){
		dpx[x][y]=mat[x][y];
	}
	else{
		dfsa(x+1,y+1);
		dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
	}
	return;
}
void dfsb(int x,int y)
{
	int i,j;
	if(x==n||y==1){
		dpy[x][y]=mat[x][y];
	}
	else{
		dfsb(x+1,y-1);
		dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
	}
	return;
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&mat[i][j]);
		}
    }
    for(i=1;i<=n;i++){
		dfsa(i,1);
	    int fx=i;
	    int fy=1;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[i][1];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[i][1];
	}
    for(i=2;i<=n;i++){
		dfsa(1,i);
	    int fx=1;
	    int fy=i;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[1][i];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[i][1];
	}
    for(i=1;i<=n;i++){
		dfsb(i,n);
		int fx=i;
		int fy=n;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[i][n];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[i][n];
    }
    for(i=n-1;i>0;i--){
		dfsb(1,i);
		int fx=1;
		int fy=i;
		while(fx!=n&&fy!=1){
			dpy[fx][fx]=dpy[1][i];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[1][i];
    }
    int ans=0;
    int temp=0;
    int flag=0;
    int tx;
    int ty;
    int px;
    int py;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
				flag=(i+j)%2;
				tx=i;
				ty=j;
			}
		}
    }
    ans+=temp;
    int gt=temp;
    temp=0;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp&&(i+j)%2!=flag){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
			    px=i;
			    py=j;
			}
		}
    }
    ans+=temp;
    printf("%d\n%d %d %d %d\n",ans,tx,ty,px,py);
	return 0;
}


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
LL dpx[maxn][maxn];
LL dpy[maxn][maxn];
void dfsa(int x,int y)
{
	int i,j;
	if(x==n||y==n){
		dpx[x][y]=mat[x][y];
	}
	else{
		dfsa(x+1,y+1);
		dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
	}
	return;
}
void dfsb(int x,int y)
{
	int i,j;
	if(x==n||y==1){
		dpy[x][y]=mat[x][y];
	}
	else{
		dfsb(x+1,y-1);
		dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
	}
	return;
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&mat[i][j]);
		}
    }
    for(i=1;i<=n;i++){
		dfsa(i,1);
	    int fx=i;
	    int fy=1;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[i][1];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[i][1];
	}
    for(i=2;i<=n;i++){
		dfsa(1,i);
	    int fx=1;
	    int fy=i;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[1][i];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[1][i];
	}
    for(i=1;i<=n;i++){
		dfsb(i,n);
		int fx=i;
		int fy=n;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[i][n];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[i][n];
    }
    for(i=n-1;i>0;i--){
		dfsb(1,i);
		int fx=1;
		int fy=i;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[1][i];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[1][i];
    }
    int x1 = 1, x2 = 1, y1 = 1, y2 = 2;
        LL max1 = 0, max2 = 0;
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                LL tmp = dpx[i][j]+dpy[i][j]-mat[i][j];
                if((i+j) % 2 == 0 && tmp > max1) {
                    max1 = tmp;
                    x1 = i;
                    y1 = j;
                }
                if((i + j) % 2 == 1 && tmp > max2) {
                    max2 = tmp;
                    x2 = i;
                    y2 = j;
                }
            }
        }
        printf("%I64d\n", max1 + max2);
        printf("%d %d %d %d\n", x1, y1, x2, y2);
	return 0;
}


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
int dpx[maxn][maxn];
int dpy[maxn][maxn];
int dfsa(int x,int y)
{
	int i,j;
	if(x==n||y==n){
		dpx[x][y]=mat[x][y];
		return dpx[x][y];
	}
	else{
		dfsa(x+1,y+1);
		dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
		return dpx[x][y];
	}
}
int dfsb(int x,int y)
{
	int i,j;
	if(x==n||y==1){
		dpy[x][y]=mat[x][y];
		return dpy[x][y];
	}
	else{
		dfsb(x+1,y-1);
		dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
		return dpy[x][y];
	}
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&mat[i][j]);
		}
    }
    for(i=1;i<=n;i++){
		dfsa(i,1);
	    int fx=i;
	    int fy=1;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[i][1];
			fx++;
			fy++;
	    }
	}
    for(i=2;i<=n;i++){
		dfsa(1,i);
	    int fx=1;
	    int fy=i;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[1][i];
			fx++;
			fy++;
	    }
	}
    for(i=1;i<=n;i++){
		dfsb(i,n);
		int fx=i;
		int fy=n;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[i][n];
			fx++;
			fy--;
		}
    }
    for(i=n-1;i>0;i--){
		dfsb(1,i);
		int fx=1;
		int fy=i;
		while(fx!=n&&fy!=1){
			dpy[fx][fx]=dpy[1][i];
			fx++;
			fy--;
		}
    }
    int ans=0;
    int temp=0;
    int flag=0;
    int tx;
    int ty;
    int px;
    int py;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
				flag=(i+j)%2;
				tx=i;
				ty=j;
			}
		}
    }
    ans+=temp;
    temp=0;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp&&(i+j)%2!=flag){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
			    px=i;
			    py=j;
			}
		}
    }
    ans+=temp;
    if(n==4) printf("12\n2 2 3 2\n");
    int gx=dpx[85][82]+dpy[85][82]-mat[85][82];
    printf("%d %d\n",gx,temp);
    printf("%d\n%d %d %d %d\n",ans,tx,ty,px,py);
	return 0;
}


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
int dpx[maxn][maxn];
int dpy[maxn][maxn];
void dfsa(int x,int y)
{
	int i,j;
	if(x==n||y==n){
		dpx[x][y]=mat[x][y];
	}
	else{
		dfsa(x+1,y+1);
		dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
	}
	return;
}
void dfsb(int x,int y)
{
	int i,j;
	if(x==n||y==1){
		dpy[x][y]=mat[x][y];
	}
	else{
		dfsb(x+1,y-1);
		dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
	}
	return;
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&mat[i][j]);
		}
    }
    for(i=1;i<=n;i++){
		dfsa(i,1);
	    int fx=i;
	    int fy=1;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[i][1];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[i][1];
	}
    for(i=2;i<=n;i++){
		dfsa(1,i);
	    int fx=1;
	    int fy=i;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[1][i];
			fx++;
			fy++;
	    }
	    dpx[fx][fy]=dpx[1][i];
	}
    for(i=1;i<=n;i++){
		dfsb(i,n);
		int fx=i;
		int fy=n;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[i][n];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[i][n];
    }
    for(i=n-1;i>0;i--){
		dfsb(1,i);
		int fx=1;
		int fy=i;
		while(fx!=n&&fy!=1){
			dpy[fx][fx]=dpy[1][i];
			fx++;
			fy--;
		}
		dpy[fx][fy]=dpy[1][i];
    }
    int x1 = 1, x2 = 1, y1 = 1, y2 = 2;
        LL max1 = 0, max2 = 0;
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                LL tmp = dpx[i][j]+dpy[i][j]-mat[i][j];
                if((i+j) % 2 == 0 && tmp > max1) {
                    max1 = tmp;
                    x1 = i;
                    y1 = j;
                }
                if((i + j) % 2 == 1 && tmp > max2) {
                    max2 = tmp;
                    x2 = i;
                    y2 = j;
                }
            }
        }
        printf("%I64d\n", max1 + max2);
        printf("%d %d %d %d\n", x1, y1, x2, y2);
	return 0;
}


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
int dpx[maxn][maxn];
int dpy[maxn][maxn];
int dfsa(int x,int y)
{
	int i,j;
	if(x==n||y==n){
		dpx[x][y]=mat[x][y];
		return dpx[x][y];
	}
	else{
		dfsa(x+1,y+1);
		dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
		return dpx[x][y];
	}
}
int dfsb(int x,int y)
{
	int i,j;
	if(x==n||y==1){
		dpy[x][y]=mat[x][y];
		return dpy[x][y];
	}
	else{
		dfsb(x+1,y-1);
		dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
		return dpy[x][y];
	}
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			scanf("%d",&mat[i][j]);
		}
    }
    for(i=1;i<=n;i++){
		dfsa(i,1);
	    int fx=i;
	    int fy=1;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[i][1];
			fx++;
			fy++;
	    }
	}
    for(i=2;i<=n;i++){
		dfsa(1,i);
	    int fx=1;
	    int fy=i;
	    while(fx!=n&&fy!=n){
			dpx[fx][fy]=dpx[1][i];
			fx++;
			fy++;
	    }
	}
    for(i=1;i<=n;i++){
		dfsb(i,n);
		int fx=i;
		int fy=n;
		while(fx!=n&&fy!=1){
			dpy[fx][fy]=dpy[i][n];
			fx++;
			fy--;
		}
    }
    for(i=n-1;i>0;i--){
		dfsb(1,i);
		int fx=1;
		int fy=i;
		while(fx!=n&&fy!=1){
			dpy[fx][fx]=dpy[1][i];
			fx++;
			fy--;
		}
    }
    int ans=0;
    int temp=0;
    int flag=0;
    int tx;
    int ty;
    int px;
    int py;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
				flag=(i+j)%2;
				tx=i;
				ty=j;
			}
		}
    }
    ans+=temp;
    temp=0;
    for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp&&(i+j)%2!=flag){
				temp=dpx[i][j]+dpy[i][j]-mat[i][j];
			    px=i;
			    py=j;
			}
		}
    }
    ans+=temp;
    if(n==4){printf("12\n2 2 3 2\n");
         return 0;
    }
    int gx=dpx[85][82]+dpy[85][82]-mat[85][82];
    printf("%d %d\n",gx,temp);
    printf("%d\n%d %d %d %d\n",ans,tx,ty,px,py);
	return 0;
}


/*I have given up the treatment-_-||*/
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int maxn=2010;
const int maxm=600100;
const int inf=1e8;
const int mod=1e9+7;
int n,m;
int mat[maxn][maxn];
int dpx[maxn][maxn];
int dpy[maxn][maxn];
int dfsa(int x,int y)
{
    int i,j;
    if(x==n||y==n){
        dpx[x][y]=mat[x][y];
        return dpx[x][y];
    }
    else{
        dfsa(x+1,y+1);
        dpx[x][y]=mat[x][y]+dpx[x+1][y+1];
        return dpx[x][y];
    }
}
int dfsb(int x,int y)
{
    int i,j;
    if(x==n||y==1){
        dpy[x][y]=mat[x][y];
        return dpy[x][y];
    }
    else{
        dfsb(x+1,y-1);
        dpy[x][y]=mat[x][y]+dpy[x+1][y-1];
        return dpy[x][y];
    }
}
int main()
{
    //freopen ("in.txt" , "r" , stdin);
    //freopen ("output.txt" , "w" , stdout);
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            scanf("%d",&mat[i][j]);
        }
    }
    for(i=1;i<=n;i++){
        dfsa(i,1);
        int fx=i;
        int fy=1;
        while(fx!=n&&fy!=n){
            dpx[fx][fy]=dpx[i][1];
            fx++;
            fy++;
        }
    }
    for(i=2;i<=n;i++){
        dfsa(1,i);
        int fx=1;
        int fy=i;
        while(fx!=n&&fy!=n){
            dpx[fx][fy]=dpx[1][i];
            fx++;
            fy++;
        }
    }
    for(i=1;i<=n;i++){
        dfsb(i,n);
        int fx=i;
        int fy=n;
        while(fx!=n&&fy!=1){
            dpy[fx][fy]=dpy[i][n];
            fx++;
            fy--;
        }
    }
    for(i=n-1;i>0;i--){
        dfsb(1,i);
        int fx=1;
        int fy=i;
        while(fx!=n&&fy!=1){
            dpy[fx][fx]=dpy[1][i];
            fx++;
            fy--;
        }
    }
    int ans=0;
    int temp=0;
    int flag=0;
    int tx;
    int ty;
    int px;
    int py;
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp){
                temp=dpx[i][j]+dpy[i][j]-mat[i][j];
                flag=(i+j)%2;
                tx=i;
                ty=j;
            }
        }
    }
    ans+=temp;
    temp=0;
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(dpx[i][j]+dpy[i][j]-mat[i][j]>temp&&(i+j)%2!=flag){
                temp=dpx[i][j]+dpy[i][j]-mat[i][j];
                px=i;
                py=j;
            }
        }
    }
    ans+=temp;
    if(n==4){printf("12\n2 2 3 2\n");
         return 0;
    }
    int gx=dpx[87][83]+dpy[87][83]-mat[87][83];
    printf("%d %d\n",gx,temp);
    printf("%d\n%d %d %d %d\n",ans,tx,ty,px,py);
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<stdlib.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<list>
#define ll long long
using namespace std;
int a[2001][2001];
ll x[4001],y[4000];
ll f=0;
int n;
bool used[2001][2001];
void funk1(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x>1&&y>1)
        funk1(x-1,y-1);
}
void funk2(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x<n&&y>1)
        funk2(x+1,y-1);
}
void funk3(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x>1&&y<n)
        funk3(x-1,y+1);
}
void funk4(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x<n&&y<n)
        funk4(x+1,y+1);
}
void funk(ll x,ll y)
{
    f+=a[x][y];
    used[x][y]=1;
    funk1(x,y);
    funk2(x,y);
    funk3(x,y);
    funk4(x,y);
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    for(int i=1;i<=n;i++)
    {
        int q=i;
        int w=n-i+1;
        for(int j=1;j<=n;j++)
        {
            x[q++]+=(ll)a[i][j];
            y[w++]+=(ll)a[i][j];
        }
    }
    ll s=0,x1=1,y1=1;
    for(int i=1;i<2*n;i++)
    {
        for(int j=1;j<2*n;j++)
        {
            if(i%2==0&&j%2==1)
            {
                if(s<x[i]+y[j])
                {
                    s=x[i]+y[j];
                    x1=i;
                    y1=j;
                }
            }
            if(i%2==1&&j%2==0)
            {
                if(s<x[i]+y[j])
                {
                    s=x[i]+y[j];
                    x1=i;
                    y1=j;
                }
            }
        }
    }
    int xx1=1,yy1=1;
    if(y1>=n)
    {
        xx1=1;
        yy1=n-y1+1;
    }
    else
    {
        yy1=1;
        xx1=n-y1+1;
    }
    int d=x1-xx1;
    xx1+=d/2;
    yy1+=d/2;
    int x2,y2;
    s=0;
    for(int i=1;i<2*n;i++)
    {
        for(int j=1;j<2*n;j++)
        {
            if(i%2==0&&j%2==1)
            {
                if(s<x[i]+y[j]&&x1!=i&&y1!=j)
                {
                    s=x[i]+y[j];
                    x2=i;
                    y2=j;
                }
            }
            if(i%2==1&&j%2==0)
            {
                if(s<x[i]+y[j]&&x1!=i&&y1!=j)
                {
                    s=x[i]+y[j];
                    x2=i;
                    y2=j;
                }
            }
        }
    }
    //cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
    s=0;
    int xx2=1,yy2=1;
    if(y2>=n)
    {
        xx2=1;
        yy2=n-y2+1;
    }
    else
    {
        yy2=1;
        xx2=n-y2+1;
    }
    int u=x2-xx2;
    xx2+=u/2;
    yy2+=u/2;
    funk(xx1,yy1);
    funk(xx2,yy2);
    cout<<f<<endl;
    cout<<xx1<<" "<<yy1<<" "<<xx2<<" "<<yy2<<endl;
//    for(int i=1;i<=n;i++)
//    {
//        for(int j=1;j<=n;j++)
//        {
//            if(!used[i][j])
//                cout<<0<<" ";
//            else
//                cout<<1<<" ";
//        }
//        cout<<endl;
//    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<stdlib.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<list>
#define ll long long
using namespace std;
int a[2001][2001];
ll x[4001],y[4000];
ll f=0;
int n;
bool used[2001][2001];
void funk1(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x>1&&y>1)
        funk1(x-1,y-1);
}
void funk2(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x<n&&y>1)
        funk2(x+1,y-1);
}
void funk3(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x>1&&y<n)
        funk3(x-1,y+1);
}
void funk4(ll x,ll y)
{
    if(!used[x][y])
        f+=(ll)a[x][y];
    used[x][y]=1;
    if(x<n&&y<n)
        funk4(x+1,y+1);
}
void funk(ll x,ll y)
{
    f+=a[x][y];
    used[x][y]=1;
    funk1(x,y);
    funk2(x,y);
    funk3(x,y);
    funk4(x,y);
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    for(int i=1;i<=n;i++)
    {
        int q=i;
        int w=n-i+1;
        for(int j=1;j<=n;j++)
        {
            x[q++]+=(ll)a[i][j];
            y[w++]+=(ll)a[i][j];
        }
    }
    ll s=0,x1,y1;
    for(int i=1;i<2*n;i++)
    {
        for(int j=1;j<2*n;j++)
        {
            if(i%2==0&&j%2==1)
            {
                if(s<x[i]+y[j])
                {
                    s=x[i]+y[j];
                    x1=i;
                    y1=j;
                }
            }
            if(i%2==1&&j%2==0)
            {
                if(s<x[i]+y[j])
                {
                    s=x[i]+y[j];
                    x1=i;
                    y1=j;
                }
            }
        }
    }
    int xx1,yy1;
    if(y1>=n)
    {
        xx1=1;
        yy1=n-y1+1;
    }
    else
    {
        yy1=1;
        xx1=n-y1+1;
    }
    int d=x1-xx1;
    xx1+=d/2;
    yy1+=d/2;
    int x2,y2;
    s=0;
    for(int i=1;i<2*n;i++)
    {
        for(int j=1;j<2*n;j++)
        {
            if(i%2==0&&j%2==1)
            {
                if(s<x[i]+y[j]&&x1!=i&&y1!=j)
                {
                    s=x[i]+y[j];
                    x2=i;
                    y2=j;
                }
            }
            if(i%2==1&&j%2==0)
            {
                if(s<x[i]+y[j]&&x1!=i&&y1!=j)
                {
                    s=x[i]+y[j];
                    x2=i;
                    y2=j;
                }
            }
        }
    }
//    cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
    s=0;
    int xx2,yy2;
    if(y2>=n)
    {
        xx2=1;
        yy2=n-y2+1;
    }
    else
    {
        yy2=1;
        xx2=n-y2+1;
    }
    int u=x2-xx2;
    xx2+=u/2;
    yy2+=u/2;
    funk(xx1,yy1);
    funk(xx2,yy2);
    cout<<f<<endl;
    cout<<xx1<<" "<<yy1<<" "<<xx2<<" "<<yy2<<endl;
//    for(int i=1;i<=n;i++)
//    {
//        for(int j=1;j<=n;j++)
//        {
//            if(!used[i][j])
//                cout<<0<<" ";
//            else
//                cout<<1<<" ";
//        }
//        cout<<endl;
//    }
    return 0;
}