#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cmath>
#include <vector>
#include <iostream>
#include <stack>
#include <set>
#include <map>
#define LSON l,m,x<<1
#define RSON m+1,r,x<<1|1
using namespace std;

const int MAX=2e5+5;
long long n,k;
long long a[MAX];
long long d[MAX],cnt,tmpd;

int main(){
	int i,last=0;

	scanf("%lld%lld",&n,&k);
	for(i=1;i<=n;i++)
	    scanf("%lld",&a[i]);
	for(i=2;i<=n;i++){
		d[i-cnt]=d[i-1-cnt]+a[last]*(i-2-cnt);
		tmpd=d[i-cnt]-(i-1-cnt)*(n-i)*a[i];
		if(tmpd<k){
		    printf("%d\n",i);
		    cnt++;
		    continue;
		}
		last=i;
	}

	return 0;
}


#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<set>
#include<cstring>
#include<ctime>
#include<cmath>
#include<iterator>
#include<functional>
#include<stack>

#define all(v) v.begin(), v.end()
#define setv(ar, val) memset(ar, val, sizeof(ar));
#define ll long long int
#define ull unsigned long long int
#define PI 3.1415926535897932384626433832795
#pragma comment(linker, "/STACK:1073741824")
using namespace std;

const int MAXN = 2e5 + 100;
ll ar[MAXN];

int main() {
#pragma warning(disable:4996)
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, k;
	scanf("%d%d", &n, &k);

	int c = 0;
	ll sum = 0;

	vector<int> v;

	for (int i = 0; i < n; i++) {
		scanf("%lld", &ar[i]);
		ll d = sum - ((n - i - 1) * ar[i] * c);
		if (d < k)
			v.push_back(i + 1);
		else {
			c++;
			sum += ar[i] * (c - 1);
		}
	}

	for (int i : v)
		printf("%d\n", i);

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	long long tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take);
			second += (cou-take-1);
		}
		else
		{
			cou--;
			second -= take;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	long long tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take);
			second += (cou-take);
		}
		else
		{
			cou--;
			second -= take-1;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	int tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take-1);
			second += (cou-take-1);
		}
		else
		{
			cou--;
			second -= take;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	long long tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take-1);
			second = (cou-take-1)*take;
		}
		else
		{
			cou--;
			second -= take;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	long long tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take);
			second += (cou-take);
		}
		else
		{
			cou--;
			second -= take;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	long long tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take-1);
			second += (cou-take-2);
		}
		else
		{
			cou--;
			second -= take;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	long long tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take-1);
			second += (cou-take);
		}
		else
		{
			cou--;
			second -= take;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<iomanip>
#include<queue>
#include<algorithm>
#include<ctime>
#include<memory.h>
#include<map>
#include<math.h>
using namespace std;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n >> k;
	long long first = 0,second=0;
	long long tmp,cou=n,take=1;
	cin >> tmp;
	second += (n - 2);
	for (int i = 0; i < n-1; i++)
	{
		long long tmp1;
		cin >> tmp1;
		long long d = first - second*tmp1;
		if (d >= k)
		{
			take++;
			first += tmp1*(take-1);
			second += (cou-take-1);
		}
		else
		{
			cou--;
			second -= take;
			cout << i + 2 << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inf 0x3f3f3f3f
#define all(v) (v).begin() , (v).end()

using namespace std;

typedef vector<int> vi;
typedef long long ll;

int main(){
    ll n , k , del = 0 , ind = 1 , x;
    scanf("%d%d",&n,&k);
    ll sum = 0;
    for(int i = 0 ;i < n;i++){
        scanf("%d",&x);
        ll value = sum - (n-del-ind)*(ind-1)*x;
        if(value >= k){
            sum += x * (ind-1);
            ind++;
        }else{
            printf("%d\n",i+1);
            del++;
        }
    }

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inf 0x3f3f3f3f
#define all(v) (v).begin() , (v).end()

using namespace std;

typedef vector<int> vi;
typedef long long ll;

int main(){
    ll n , k , del = 0 , ind = 1 , x;
    scanf("%lld%lld",&n,&k);
    ll sum = 0;
    for(int i = 0 ;i < n;i++){
        scanf("%lld",&x);
        ll value = sum - (n-del-ind)*(ind-1)*x;
        if(value >= k){
            sum += x * (ind-1);
            ind++;
        }else{
            printf("%d\n",i+1);
            del++;
        }
    }

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inf 0x3f3f3f3f
#define all(v) (v).begin() , (v).end()

using namespace std;

typedef vector<int> vi;
typedef long long ll;

int main(){
    int n , k , del = 0 , ind = 1 , x;
    scanf("%d%d",&n,&k);
    ll sum = 0;
    for(int i = 0 ;i < n;i++){
        scanf("%d",&x);
        ll value = sum - (n-del-ind)*(ind-1)*x;
        if(value >= k){
            sum += x * (ind-1);
            ind++;
        }else{
            printf("%d\n",i+1);
            del++;
        }
    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
    ios::sync_with_stdio(0);
    lli n, i, k, x=1, b=0;
    cin>>n>>k;
    lli a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    for(i=1;i<n;i++){
        if(b-x*a[i]*(n-i-1)<k)
            cout<<i+1<<endl;
        else{
            x++;
            b+=x*a[i];
        }
    }
    return 0;
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

#define N 2000

int chess[N][N];
int upRight[N][N], upLeft[N][N];
int downRight[N][N], downLeft[N][N];

int main() {
	int n;
	cin >> n;

	int white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = 0, a = n-1; i < n && a >= 0; i++, a--) {
		for(int j = 0, b = n-1; j < n && b >= 0; j++, b--) {
			scanf("%d", &chess[i][j]);

			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			long long val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white <= val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black <= val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	printf("%d\n%d %d %d %d\n", (white+black), wi+1, wj+1, bi+1, bj+1);
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

#define N 2000

int chess[N][N];
long long upRight[N][N], upLeft[N][N];
long long downRight[N][N], downLeft[N][N];

int main() {
	int n;
	cin >> n;

	long long white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = 0, a = n-1; i < n && a >= 0; i++, a--) {
		for(int j = 0, b = n-1; j < n && b >= 0; j++, b--) {
			scanf("%d", &chess[i][j]);

			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			long long val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white <= val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black <= val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	cout << (white+black) << endl;
	cout << wi+1 << " " << wj+1 << " " << bi+1 << " " << bj+1 << endl;
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

#define N 2000

int chess[N][N];
long long upRight[N][N], upLeft[N][N];
long long downRight[N][N], downLeft[N][N];

int main() {
	int n;
	cin >> n;

	long long white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = 0, a = n-1; i < n && a >= 0; i++, a--) {
		for(int j = 0, b = n-1; j < n && b >= 0; j++, b--) {
			scanf("%d", &chess[i][j]);

			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			long long val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white <= val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black <= val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	cout << (long long)(white+black) << endl;
	cout << wi+1 << " " << wj+1 << " " << bi+1 << " " << bj+1 << endl;
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

#define N 2000

int chess[N][N];
int upRight[N][N], upLeft[N][N];
int downRight[N][N], downLeft[N][N];

int main() {
	int n;
	cin >> n;

	int white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = 0, a = n-1; i < n && a >= 0; i++, a--) {
		for(int j = 0, b = n-1; j < n && b >= 0; j++, b--) {
			scanf("%d", &chess[i][j]);

			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			long long val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white < val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black < val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	printf("%d\n%d %d %d %d\n", (white+black), wi+1, wj+1, bi+1, bj+1);
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

int main() {
	int n;
	cin >> n;

	int chess[n][n];
	long long upRight[n][n], upLeft[n][n];
	long long downRight[n][n], downLeft[n][n];

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			cin >> chess[i][j];

			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	int white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			int val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white < val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black < val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	cout << (white+black) << endl;
	cout << wi+1 << " " << wj+1 << " " << bi+1 << " " << bj+1 << endl;
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

int main() {
	int n;
	cin >> n;

	int chess[n][n];
	for(int i = 0; i < n; i++)
	for(int j = 0; j < n; j++)
	cin >> chess[i][j];

	long long upRight[n][n], upLeft[n][n];
	long long downRight[n][n], downLeft[n][n];

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	int white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			int val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white < val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black < val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	cout << (white+black) << endl;
	cout << wi+1 << " " << wj+1 << " " << bi+1 << " " << bj+1 << endl;
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

#define N 2000

int chess[N][N];
long long upRight[N][N], upLeft[N][N];
long long downRight[N][N], downLeft[N][N];

int main() {
	int n;
	cin >> n;

	long long white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = 0, a = n-1; i < n && a >= 0; i++, a--) {
		for(int j = 0, b = n-1; j < n && b >= 0; j++, b--) {
			scanf("%d", &chess[i][j]);

			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			long long val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white <= val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black <= val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	printf("%d\n%d %d %d %d\n", (white+black), wi+1, wj+1, bi+1, bj+1);
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

#define N 2001

long long chess[N][N];
long long upRight[N][N], upLeft[N][N];
long long downRight[N][N], downLeft[N][N];

int main() {
	int n;
	scanf("%d", &n);

	long long white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			scanf("%I64d", &chess[i][j]);

			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}

			long long val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white <= val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black <= val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	cout << (long long)(white+black) << endl;
	cout << wi+1 << " " << wj+1 << " " << bi+1 << " " << bj+1 << endl;
}


#ifndef __MYLIB_H
#define __MYLIB_H

#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<algorithm>
#include<map>
#include<utility>  // pair, make_pair
#include<cstdio>
#include<cmath>
#include<cstring>
#include<climits>
using namespace std;
#endif

int main() {
	int n;
	cin >> n;

	int chess[n][n];
	for(int i = 0; i < n; i++)
	for(int j = 0; j < n; j++)
	cin >> chess[i][j];

	long long upRight[n][n], upLeft[n][n];
	long long downRight[n][n], downLeft[n][n];

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			upRight[i][j] = upLeft[i][j] = chess[i][j];

			if((i-1) >= 0 && (j-1) >= 0) {
				upLeft[i][j] += upLeft[i-1][j-1];
			}
			if((i-1) >= 0 && (j+1) < n) {
				upRight[i][j] += upRight[i-1][j+1];
			}
		}
	}

	for(int i = n-1; i >= 0; i--) {
		for(int j = n-1; j >= 0; j--) {
			downRight[i][j] = downLeft[i][j] = chess[i][j];

			if((i+1) < n && (j-1) >= 0) {
				downLeft[i][j] += downLeft[i+1][j-1];
			}
			if((i+1) < n && (j+1) < n) {
				downRight[i][j] += downRight[i+1][j+1];
			}
		}
	}

	int white = 0, black = 0;
	int wi, wj, bi, bj;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {

			int val = upLeft[i][j]+upRight[i][j]+downLeft[i][j]+downRight[i][j];
			val -= (chess[i][j]*3);

			if((i%2 == 0 && j%2 == 0) || (i%2 != 0 && j%2 != 0))  {
				if(white < val) {
					white = val;
					wi = i, wj = j;
				}
			}
			else {
				if(black < val) {
					black = val;
					bi = i, bj = j;
				}
			}
		}
	}

	cout << (white+black) << endl;
	cout << wi+1 << " " << wj+1 << " " << bi+1 << " " << bj+1 << endl;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
#define SF scanf
#define PF printf
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	scanf("%d",&n);
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) printf("%I64d",&matrix[i][j]);
	rep(i,n){
		rep(j,n){
			long long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3ll*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	printf("%I64d",sum1+sum2);
	printf("%I64d %I64d %I64d %I64d\n",best1.fr,best1.se,best2.fr,best2.se);
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long int l;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
ll mat[N][N],dp[N][N][4],res[N][N];
pair<int,int> odd,even;
ll f(int n){
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j][0]=mat[i-1][j-1]+dp[i-1][j-1][0];
            res[i][j]+=dp[i][j][0];
        }
    }
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j][1]=mat[i-1][j+1]+dp[i-1][j+1][1];
            res[i][j]+=dp[i][j][1];
        }
    }
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j][2]=mat[i+1][j-1]+dp[i+1][j-1][2];
            res[i][j]+=dp[i][j][2];
        }
    }
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j][3]=mat[i+1][j+1]+dp[i+1][j+1][3];
            res[i][j]+=dp[i][j][3];
        }
    }
    ll res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    SF("%I64d",&n);
    Rep(i,n)Rep(j,n)
        SF("%I64d",&mat[i][j]);
    odd.fr = 1;
    odd.se = 2;
    even.fr = 1;
    even.se = 1;
    PF("%I64d",f(n));
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) cin >> matrix[i][j];
	rep(i,n){
		rep(j,n){
			long long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3ll*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	cout << (sum1+sum2) << endl;
	cout << best1.fr << " " << best1.se << " " << best2.fr << " " << best2.se << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) cin >> matrix[i][j];
	rep(i,n){
		rep(j,n){
			long long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3ll*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	cout << (sum1+sum2) << endl;
	cout << best1.fr << " " << best1.se << " " << best2.fr << " " << best2.se << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
#define SF scanf
#define PF printf
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	SF("%d",&n);
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) SF("%I64d",&matrix[i][j]);
	rep(i,n){
		rep(j,n){
			long long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3ll*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	PF("%I64d\n",sum1+sum2);
	PF("%d %d %d %d\n",best1.fr,best1.se,best2.fr,best2.se);
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long l;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
int mat[N][N],dp[N][N],res[N][N];
pair<int,int> odd,even;
int f(int n){
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i-1][j-1]+dp[i-1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j]=mat[i-1][j+1]+dp[i-1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i+1][j-1]+dp[i+1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j]=mat[i+1][j+1]+dp[i+1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    int res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    cin >> n;
    Rep(i,n)Rep(j,n)
        cin >> mat[i][j];
    odd.fr = 1;
    odd.se = 1;
    even.fr = 1;
    even.se = 1;
    cout << f(n) << endl;
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long l;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
ll mat[N][N],dp[N][N],res[N][N];
pair<int,int> odd,even;
int f(int n){
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i-1][j-1]+dp[i-1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j]=mat[i-1][j+1]+dp[i-1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i+1][j-1]+dp[i+1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j]=mat[i+1][j+1]+dp[i+1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    int res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    cin >> n;
    Rep(i,n)Rep(j,n)
        cin >> mat[i][j];
    odd.fr = 1;
    odd.se = 2;
    even.fr = 1;
    even.se = 1;
    cout << f(n) << endl;
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long l;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
int mat[N][N],dp[N][N],res[N][N];
pair<int,int> odd,even;
int f(int n){
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i-1][j-1]+dp[i-1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j]=mat[i-1][j+1]+dp[i-1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i+1][j-1]+dp[i+1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j]=mat[i+1][j+1]+dp[i+1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    int res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    cin >> n;
    Rep(i,n)Rep(j,n)
        cin >> mat[i][j];
    cout << f(n) << endl;
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long l;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
int mat[N][N],dp[N][N],res[N][N];
pair<int,int> odd,even;
int f(int n){
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i-1][j-1]+dp[i-1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j]=mat[i-1][j+1]+dp[i-1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i+1][j-1]+dp[i+1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j]=mat[i+1][j+1]+dp[i+1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    int res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    cin >> n;
    Rep(i,n)Rep(j,n)
        cin >> mat[i][j];
    odd.fr = 1;
    odd.se = 2;
    even.fr = 1;
    even.se = 1;
    cout << f(n) << endl;
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long int l;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
ll mat[N][N],dp[N][N][4],res[N][N];
pair<int,int> odd,even;
ll f(int n){
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j][0]=mat[i-1][j-1]+dp[i-1][j-1][0];
            res[i][j]+=dp[i][j][0];
        }
    }
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j][1]=mat[i-1][j+1]+dp[i-1][j+1][1];
            res[i][j]+=dp[i][j][1];
        }
    }
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j][2]=mat[i+1][j-1]+dp[i+1][j-1][2];
            res[i][j]+=dp[i][j][2];
        }
    }
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j][3]=mat[i+1][j+1]+dp[i+1][j+1][3];
            res[i][j]+=dp[i][j][3];
        }
    }
    ll res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    SF("%I64d",&n);
    Rep(i,n)Rep(j,n)
        SF("%I64d",&mat[i][j]);
    memset(dp,0,sizeof(dp));
    odd.fr = 1;
    odd.se = 2;
    even.fr = 1;
    even.se = 1;
    PF("%I64d\n",f(n));
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
const int maxn = 2001;
int n;
long int matrix[maxn][maxn];
long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) cin >> matrix[i][j];
	rep(i,n){
		rep(j,n){
			long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	cout << sum1+sum2 << endl;
	cout << best1.fr << " " << best1.se << " " << best2.fr << " " << best2.se << endl;
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long int l;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
ll mat[N][N],dp[N][N],res[N][N];
pair<int,int> odd,even;
ll f(int n){
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i-1][j-1]+dp[i-1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j]=mat[i-1][j+1]+dp[i-1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i+1][j-1]+dp[i+1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j]=mat[i+1][j+1]+dp[i+1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    ll res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    cin >> n;
    Rep(i,n)Rep(j,n)
        cin >> mat[i][j];
    odd.fr = 1;
    odd.se = 2;
    even.fr = 1;
    even.se = 1;
    cout << f(n) << endl;
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) cin >> matrix[i][j];
	rep(i,n){
		rep(j,n){
		//	long long int val = 0;
			rep(k,4)solve(k,i,j);
		//	matrix[i][j]=val-3ll*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			long long int tmp = 0;
			rep(z,4)tmp+=solve(z,i,j);
			tmp-=3*matrix[i][j];
			if((i+j)%2){
				if(sum1<tmp){
					sum1=tmp;
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<tmp){
					sum2=tmp;
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	cout << (sum1+sum2) << endl;
	cout << best1.fr << " " << best1.se << " " << best2.fr << " " << best2.se << endl;
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long l;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
ll mat[N][N],dp[N][N],res[N][N];
pair<int,int> odd,even;
ll f(int n){
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i-1][j-1]+dp[i-1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j]=mat[i-1][j+1]+dp[i-1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i+1][j-1]+dp[i+1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j]=mat[i+1][j+1]+dp[i+1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    int res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    cin >> n;
    Rep(i,n)Rep(j,n)
        cin >> mat[i][j];
    odd.fr = 1;
    odd.se = 2;
    even.fr = 1;
    even.se = 1;
    cout << f(n) << endl;
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) cin >> matrix[i][j];
	rep(i,n){
		rep(j,n){
		//	long long int val = 0;
			rep(k,4)solve(k,i,j);
		//	matrix[i][j]=val-3ll*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			int tmp = 0;
			rep(z,4)tmp+=solve(z,i,j);
			tmp-=3*matrix[i][j];
			if((i+j)%2){
				if(sum1<tmp){
					sum1=tmp;
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<tmp){
					sum2=tmp;
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	cout << (sum1+sum2) << endl;
	cout << best1.fr << " " << best1.se << " " << best2.fr << " " << best2.se << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) cin >> matrix[i][j];
	rep(i,n){
		rep(j,n){
			long long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	cout << sum1+sum2 << endl;
	cout << best1.fr << " " << best1.se << " " << best2.fr << " " << best2.se << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	cin >> n;
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) cin >> matrix[i][j];
	rep(i,n){
		rep(j,n){
			long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	cout << sum1+sum2 << endl;
	cout << best1.fr << " " << best1.se << " " << best2.fr << " " << best2.se << endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define fr first
#define se second
#define SF scanf
#define PF printf
const int maxn = 2001;
int n;
long long int matrix[maxn][maxn];
long long int dp[4][maxn][maxn];
int dx[]={-1,-1,1,1},dy[]={-1,1,-1,1};
long long int solve(int dir,int row,int col){
	if(row==-1 || row==n || col==-1 || col==n)return 0;
	if(~dp[dir][row][col])return dp[dir][row][col];
	return dp[dir][row][col]=matrix[row][col]+solve(dir,row+dx[dir],col+dy[dir]);
}
int main(){
	SF("%d",&n);
	memset(dp,-1,sizeof(dp));
	rep(i,n) rep(j,n) SF("%I64d",&matrix[i][j]);
	rep(i,n){
		rep(j,n){
			long long int val = 0;
			rep(k,4)val+=solve(k,i,j);
			matrix[i][j]=val-3ll*matrix[i][j];
		}
	}
	pair<int,int> best1,best2;
	long long int sum1=-1,sum2=-1;
	rep(i,n){
		rep(j,n){
			if((i+j)%2){
				if(sum1<matrix[i][j]){
					sum1=matrix[i][j];
					best1.fr = i+1;
					best1.se = j+1;
				}
			}else{
				if(sum2<matrix[i][j]){
					sum2=matrix[i][j];
					best2.fr = i+1;
					best2.se = j+1;
				}
			}
		}
	}
	PF("%I64d\n",sum1+sum2);
	PF("%I64d %I64d %I64d %I64d\n",best1.fr,best1.se,best2.fr,best2.se);
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
#define Rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define Rep_(i,n) for(int i = (n)-1 ; i >= 0 ; i--)
#define For(i,a,b) for(int i = (a) ; i < (b) ; i++)
#define For_(i,a,b) for(int i = (b)-1 ; i >= (a) ; i--)
#define Forv(i,v) for(int  i = 0 ; i < v.size() ; i++)
#define Forv(i,v) for(int  i = v.size()-1 ; i >= 0 ; i--)
#define SF scanf
#define PF printf
#define fr first
#define se second
#define max(a,b) ( ((a)>=(b)) ? (a) : (b) )
#define min(a,b) ( ((a)>=(b)) ? (b) : (a) )
#define two(x) (1LL<<(x))
#define range(x,a,b) (((x)>=min(a,b)) && ((x)<=max(a,b)))
#define All(v) v.begin(),v.end()
typedef long l;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
#define N 2001
int mat[N][N],dp[N][N],res[N][N];
pair<int,int> odd,even;
int f(int n){
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = 1 ; i < n ; i++){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i-1][j-1]+dp[i-1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i =  1 ; i < n ; i++){
        for(int j = n-2 ; j>=0 ; j--){
            dp[i][j]=mat[i-1][j+1]+dp[i-1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = 1 ; j < n ; j++){
            dp[i][j]=mat[i+1][j-1]+dp[i+1][j-1];
            res[i][j]+=dp[i][j];
        }
    }
    Rep(i,n)Rep(j,n)dp[i][j]=0;
    for(int i = n-2 ; i >= 0 ; i--){
        for(int j = n-2 ; j >= 0 ; j--){
            dp[i][j]=mat[i+1][j+1]+dp[i+1][j+1];
            res[i][j]+=dp[i][j];
        }
    }
    int res1=0,res2=0;
    Rep(i,n)Rep(j,n){
        if((i+j)&1){
            if(res[i][j]+mat[i][j]>res1){
                res1=res[i][j]+mat[i][j];
                odd.fr = i+1;
                odd.se = j+1;
            }
        }else{
            if(res[i][j]+mat[i][j]>res2){
            res2=res[i][j]+mat[i][j];
            even.fr = i+1;
            even.se = j+1;
            }
        }
    }
    return res1+res2;
}
int main(){
    int n;
    cin >> n;
    Rep(i,n)Rep(j,n)
        cin >> mat[i][j];
    odd.fr = 1;
    odd.se = 1;
    even.fr = 1;
    even.fr = 1;
    cout << f(n) << endl;
    cout << even.fr << " " << even.se << " " << odd.fr << " " << odd.se << endl;
    return EXIT_SUCCESS;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>
using namespace std;

typedef long long llt;
#define maxn 2005

int a[maxn][maxn];
int a2[maxn << 1][maxn << 1];
bool b[maxn << 1][maxn << 1];
llt sum[2][maxn << 1];

int cmp(const void *a, const void* b) {
    return *(llt*) a - *(llt*) b;
}

int main() {
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j)
            cin >> a[i][j];
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= i; ++j) {
            a2[i][n - 1 - i + j * 2] = a[j][n - 1 - i + j];
            b[i][n - 1 - i + j * 2] = true;
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n - i; ++j) {
            a2[n - 1 + i][i + j * 2] = a[i + j][j];
            b[n - 1 + i][i + j * 2] = true;
        }
    }

    for (int i = 0; i < n * 2 - 1; ++i) {
        sum[0][i] = 0;
        sum[1][i] = 0;
        for (int j = 0; j < n * 2 - 1; ++j) {
            sum[0][i] += a2[i][j];
            sum[1][i] += a2[j][i];
        }
    }

    llt res = 0;
    llt ma = -1;
    llt tmp = 0;
    int x1, x2, y1, y2;

//    for (int i = 0; i < n * 2 - 1; ++i) {
//        for (int j = 0; j < n * 2 - 1; ++j) {
//            cout << a2[i][j] << " ";
//        }
//        cout << endl;
//    }
    for (int i = 0; i < n * 2 - 1; ++i) {
        for (int j = 0; j < n * 2 - 1; ++j) {
            if (i + j < n - 1 || j - i > n || i - j > n || i + j >= n * 3 - 3 || !b[i][j])
                continue;
            tmp = sum[0][i] + sum[1][j] - a2[i][j];
            if (tmp > ma) {
                ma = tmp;
                x1 = i;
                y1 = j;
            }
        }
    }

    res += ma;

    ma = -1;
    for (int i = 0; i < n * 2 - 1; ++i) {
        for (int j = 0; j < n * 2 - 1; ++j) {
            if (i + j < n - 1 || j - i > n || i - j > n || i + j >= n * 3 - 3 || !b[i][j])
                continue;
            if (i == x1 || j == y1 || (i - x1) % 2 == 0)
                continue;
            tmp = sum[0][i] + sum[1][j] - a2[i][j];
            if (tmp > ma) {
                ma = tmp;
                x2 = i;
                y2 = j;
            }
        }
    }

    res += ma;

    cout << res << endl;
//    cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;

    int xx1, yy1, xx2, yy2;

    if (x1 >= n) {
        yy1 = (y1 - x1 + (n - 1)) / 2;
        xx1 = y1 - yy1;
    } else {
        xx1 = (y1 + x1 - (n - 1)) / 2;
        yy1 = y1 - xx1;
    }

    if (x2 >= n) {
        yy2 = (y2 - x2 + (n - 1)) / 2;
        xx2 = y2 - yy2;
    } else {
        xx2 = (y2 + x2 - (n - 1)) / 2;
        yy2 = y2 - xx2;
    }

//    cout << x1 + 1 << " " << y1 + 1 << " " << x2 + 1 << " " << y2 + 1 << endl;
    cout << xx1 + 1 << " " << yy1 + 1 << " " << xx2 + 1 << " " << yy2 + 1 << endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>
using namespace std;

typedef long long llt;
#define maxn 2005

int a[maxn][maxn];
llt sum[2][maxn << 1];
llt res[2][3];

inline void updateRes(int type, int i, int j, llt val) {
    if (val > res[type][0]) {
        res[type][0] = val;
        res[type][1] = i;
        res[type][2] = j;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
            sum[0][i + j] += a[i][j];
            sum[1][i - j + n - 1] += a[i][j];
        }
    }

    res[0][0] = res[1][0] = -1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            updateRes((i + j) & 1, i, j, sum[0][i + j] + sum[1][i - j + n - 1] - a[i][j]);
        }
    }

    cout << res[0][0] + res[1][0] << endl;
    cout << res[0][1] + 1 << " " << res[0][2] + 1 << " " << res[1][1] + 1 << " " << res[1][2] + 1 << endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>
using namespace std;

typedef long long llt;
#define maxn 2005

int a[maxn][maxn];
int a2[maxn << 1][maxn << 1];
bool b[maxn << 1][maxn << 1];
llt sum[2][maxn << 1];

int cmp(const void *a, const void* b) {
    return *(llt*) a - *(llt*) b;
}

int main() {
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j)
            cin >> a[i][j];
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= i; ++j) {
            a2[i][n - 1 - i + j * 2] = a[j][n - 1 - i + j];
            b[i][n - 1 - i + j * 2] = true;
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n - i; ++j) {
            a2[n - 1 + i][i + j * 2] = a[i + j][j];
            b[n - 1 + i][i + j * 2] = true;
        }
    }

    for (int i = 0; i < n * 2 - 1; ++i) {
        sum[0][i] = 0;
        sum[1][i] = 0;
        for (int j = 0; j < n * 2 - 1; ++j) {
            sum[0][i] += a2[i][j];
            sum[1][i] += a2[j][i];
        }
    }

    llt res = 0;
    llt ma = -1;
    llt tmp = 0;
    int x1, x2, y1, y2;

//    for (int i = 0; i < n * 2 - 1; ++i) {
//        for (int j = 0; j < n * 2 - 1; ++j) {
//            cout << a2[i][j] << " ";
//        }
//        cout << endl;
//    }
    for (int i = 0; i < n * 2 - 1; ++i) {
        for (int j = 0; j < n * 2 - 1; ++j) {
            if (i + j < n - 1 || j - i > n || i - j > n || i + j >= n * 3 - 3 || !b[i][j])
                continue;
            tmp = sum[0][i] + sum[1][j] - a2[i][j];
            if (tmp > ma) {
                ma = tmp;
                x1 = i;
                y1 = j;
            }
        }
    }

    res += ma;

    ma = -1;
    for (int i = 0; i < n * 2 - 1; ++i) {
        for (int j = 0; j < n * 2 - 1; ++j) {
            if (i + j < n - 1 || j - i > n || i - j > n || i + j >= n * 3 - 3 || !b[i][j])
                continue;
            if (i == x1 || j == y1 || (i - x1) % 2 == 0)
                continue;
            tmp = sum[0][i] + sum[1][j] - a2[i][j];
            if (tmp > ma) {
                ma = tmp;
                x2 = i;
                y2 = j;
            }
        }
    }

    res += ma;

    cout << res << endl;
//    cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;

    int xx1, yy1, xx2, yy2;

    if (x1 >= n) {
        yy1 = (y1 - x1 + (n - 1)) / 2;
        xx1 = y1 - yy1;
    } else {
        xx1 = (y1 + x1 - (n - 1)) / 2;
        yy1 = y1 - xx1;
    }

    if (x2 >= n) {
        yy2 = (y2 - x2 + (n - 1)) / 2;
        xx2 = y2 - yy2;
    } else {
        xx2 = (y2 + x2 - (n - 1)) / 2;
        yy2 = y2 - xx2;
    }

//    cout << x1 + 1 << " " << y1 + 1 << " " << x2 + 1 << " " << y2 + 1 << endl;
    cout << xx1 + 1 << " " << yy1 + 1 << " " << xx2 + 1 << " " << yy2 + 1 << endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

typedef long long llt;
#define maxn 2005

int a[maxn][maxn];
int a2[maxn << 1][maxn << 1];
bool b[maxn << 1][maxn << 1];
llt sum[2][maxn << 1];

int cmp(const void *a, const void* b) {
    return *(llt*) a - *(llt*) b;
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j)
            cin >> a[i][j];
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= i; ++j) {
            a2[i][n - 1 - i + j * 2] = a[j][n - 1 - i + j];
            b[i][n - 1 - i + j * 2] = true;
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n - i; ++j) {
            a2[n - 1 + i][i + j * 2] = a[i + j][j];
            b[n - 1 + i][i + j * 2] = true;
        }
    }

    for (int i = 0; i < n * 2 - 1; ++i) {
        sum[0][i] = 0;
        sum[1][i] = 0;
        for (int j = 0; j < n * 2 - 1; ++j) {
            sum[0][i] += a2[i][j];
            sum[1][i] += a2[j][i];
        }
    }

    llt res = 0;
    llt ma = -1;
    llt tmp = 0;
    int x1, x2, y1, y2;

//    for (int i = 0; i < n * 2 - 1; ++i) {
//        for (int j = 0; j < n * 2 - 1; ++j) {
//            cout << a2[i][j] << " ";
//        }
//        cout << endl;
//    }
    for (int i = 0; i < n * 2 - 1; ++i) {
        for (int j = 0; j < n * 2 - 1; ++j) {
            if (i + j < n - 1 || j - i > n || i - j > n || i + j >= n * 3 - 3 || !b[i][j])
                continue;
            tmp = sum[0][i] + sum[1][j] - a2[i][j];
            if (tmp > ma) {
                ma = tmp;
                x1 = i;
                y1 = j;
            }
        }
    }

    res += ma;
//    cout << res << endl;

    ma = -1;
    for (int i = 0; i < n * 2 - 1; ++i) {
        for (int j = 0; j < n * 2 - 1; ++j) {
            if (i + j < n - 1 || j - i > n || i - j > n || i + j >= n * 3 - 3 || !b[i][j])
                continue;
            if (i == x1 || j == y1)
                continue;
            tmp = sum[0][i] + sum[1][j] - a2[i][j];
            if (tmp > ma) {
                ma = tmp;
                x2 = i;
                y2 = j;
            }
        }
    }

    res += ma;

    cout << res << endl;
//    cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;

    y1 /= 2;
    if (x1 >= n - 1)
        x1 = x1 - n + 1 + y1;
    else
        x1 = y1;

    y2 /= 2;
    if (x2 >= n - 1)
        x2 = x2 - n + 1 + y2;
    else
        x2 = y2;

//    cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
    cout << x1 + 1 << " " << y1 + 1 << " " << x2 + 1 << " " << y2 + 1 << endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>
using namespace std;

typedef long long llt;
#define maxn 2005

int a[maxn][maxn];
llt sum[2][maxn << 1];
llt res[2][3];

void updateRes(int type, int i, int j, llt val) {
    if (val > res[type][0]) {
        res[type][0] = val;
        res[type][1] = i;
        res[type][2] = j;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
            sum[0][i + j] += a[i][j];
            sum[1][i - j + n - 1] += a[i][j];
        }
    }

    res[0][0] = res[1][0] = -1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            updateRes((i + j) & 1, i, j, sum[0][i + j] + sum[1][i - j + n - 1] - a[i][j]);
        }
    }

    cout << res[0][0] + res[1][0] << endl;
    cout << res[0][1] + 1 << " " << res[0][2] + 1 << " " << res[1][1] + 1 << " " << res[1][2] + 1 << endl;

    return 0;
}


#include <iostream>
#include <cstdio>

using namespace std;
const int NMAX = 2014;
long long d1[2*NMAX], d2[2*NMAX], sol[2];
pair < int , int > v[2];
int a[NMAX][NMAX];
inline void Update(const int c,const int i,const int j,const long long val){
    if(val > sol[c]){
        sol[c] = val;
        v[c].first = i;
        v[c].second = j;
    }
}
int main(){
    #ifndef ONLINE_JUDGE
        freopen("date.in","r",stdin);
        freopen("date.out","w",stdout);
    #endif
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    sol[0] = sol[1] = -1;
    for(int i = 1;i <= n; ++i)
        for(int j = 1;j <= n; ++j){
            int x;
            cin >> a[i][j];
            d1[i+j] += a[i][j];
            d2[i-j+n] += a[i][j];
        }
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j)
            Update((i+j)&1,i,j,d1[i+j]+d2[i-j+n]-a[i][j]);
    cout<<sol[0]+sol[1]<<"\n";
    if(v[0] > v[1])
        swap(v[0],v[1]);
    cout<<v[0].first<<" "<<v[0].second<<" ";
    cout<<v[1].first<<" "<<v[1].second<<"\n";
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>
using namespace std;

typedef long long llt;
#define maxn 2005

int a[maxn][maxn];
llt sum[2][maxn << 1];
llt res[2][3];

void updateRes(int type, int i, int j, llt val) {
    if (val > res[type][0]) {
        res[type][0] = val;
        res[type][1] = i;
        res[type][2] = j;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
            sum[0][i + j] += a[i][j];
            sum[1][i - j + n - 1] += a[i][j];
        }
    }

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            updateRes((i + j) & 1, i, j, sum[0][i + j] + sum[1][i - j + n - 1] - a[i][j]);
        }
    }

    cout << res[0][0] + res[1][0] << endl;
    cout << res[0][1] + 1 << " " << res[0][2] + 1 << " " << res[1][1] + 1 << " " << res[1][2] + 1 << endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <math.h>
using namespace std;

typedef long long llt;
#define maxn 2005

int a[maxn][maxn];
llt sum[2][maxn << 1];
llt res[2][3];

inline void updateRes(int type, int i, int j, llt val) {
    if (val > res[type][0]) {
        res[type][0] = val;
        res[type][1] = i;
        res[type][2] = j;
    }
}

int main() {
    cin.sync_with_stdio(false);

    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
            sum[0][i + j] += a[i][j];
            sum[1][i - j + n - 1] += a[i][j];
        }
    }

    res[0][0] = res[1][0] = -1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            updateRes((i + j) & 1, i, j, sum[0][i + j] + sum[1][i - j + n - 1] - a[i][j]);
        }
    }

    cout << res[0][0] + res[1][0] << endl;
    cout << res[0][1] + 1 << " " << res[0][2] + 1 << " " << res[1][1] + 1 << " " << res[1][2] + 1 << endl;

    return 0;
}


//============================================================================
// 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 + (n-1-i);
            if (xx >= 0 && xx % 2 == 0)
                y[0][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++) {

        // 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 && arr[ix][iy] != -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 && arr[ix][iy] != -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;
                    }
                }
            }
        }
    }
//  prnt();
//  printf("%I64d %d %d\n", Max, ax, ay);
    x[ii][abs(ax - ay)] = 0;
    y[n - ax - 1 >= ay?0:1][abs(n - ax - 1 - ay)] = 0;
    for (int i = ax; i >= 0; i--) {
        int c = ax - i;
        if (ay + c < n)
            arr[i][ay + c] = -1;
        if (ay - c >= 0)
            arr[i][ay - c] = -1;
    }

    for (int i = ax + 1; i < n; i++) {
        int c = i - ax;
        if (ay + c < n)
            arr[i][ay + c] = -1;
        if (ay - c >= 0)
            arr[i][ay - c] = -1;
    }
//  prnt();

}

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;
}

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&&(xx/2-i)>=0&&(xx/2-i)<n)
                x[0][i] = -1;

            xx = -i + zz;
            if (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 >= 0 && xx % 2 == 0&&(xx/2-i)>=0&&(xx/2-i)<n)
                y[0][i] = -1;
            xx = yy + i+n-1;
            if (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/2<n&&xx >= 0 && xx % 2 == 0&&(xx/2-i)>=0&&(xx/2-i)<n)
                x[0][i] = -1;

            xx = -i + zz;
            if (xx/2<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/2<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/2<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 (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 (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;
}

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 = 1; i < n - 1; i++) {
        for (int j = 1; j < n - 1; 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);
}