#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgaW50IE5NQVggPSAyMDE0Owpsb25nIGxvbmcgZDFbMipOTUFYXSwgZDJbMipOTUFYXSwgc29sWzJdOwpwYWlyIDwgaW50ICwgaW50ID4gdlsyXTsKaW50IGFbTk1BWF1bTk1BWF07CmlubGluZSB2b2lkIFVwZGF0ZShjb25zdCBpbnQgYyxjb25zdCBpbnQgaSxjb25zdCBpbnQgaixjb25zdCBsb25nIGxvbmcgdmFsKXsKICAgIGlmKHZhbCA+IHNvbFtjXSl7CiAgICAgICAgc29sW2NdID0gdmFsOwogICAgICAgIHZbY10uZmlyc3QgPSBpOwogICAgICAgIHZbY10uc2Vjb25kID0gajsKICAgIH0KfQppbnQgbWFpbigpewogICAgI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgICAgICBmcmVvcGVuKCJkYXRlLmluIiwiciIsc3RkaW4pOwogICAgICAgIGZyZW9wZW4oImRhdGUub3V0IiwidyIsc3Rkb3V0KTsKICAgICNlbmRpZgogICAgY2luLnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBpbnQgbjsKICAgIGNpbiA+PiBuOwogICAgc29sWzBdID0gc29sWzFdID0gLTE7IAogICAgZm9yKGludCBpID0gMTtpIDw9IG47ICsraSkKICAgICAgICBmb3IoaW50IGogPSAxO2ogPD0gbjsgKytqKXsKICAgICAgICAgICAgaW50IHg7CiAgICAgICAgICAgIGNpbiA+PiBhW2ldW2pdOwogICAgICAgICAgICBkMVtpK2pdICs9IGFbaV1bal07CiAgICAgICAgICAgIGQyW2ktaituXSArPSBhW2ldW2pdOwogICAgICAgIH0KICAgIGZvcihpbnQgaT0xO2k8PW47KytpKQogICAgICAgIGZvcihpbnQgaj0xO2o8PW47KytqKQogICAgICAgICAgICBVcGRhdGUoKGkraikmMSxpLGosZDFbaStqXStkMltpLWorbl0tYVtpXVtqXSk7CiAgICBjb3V0PDxzb2xbMF0rc29sWzFdPDwiXG4iOwogICAgaWYodlswXSA+IHZbMV0pCiAgICAgICAgc3dhcCh2WzBdLHZbMV0pOwogICAgY291dDw8dlswXS5maXJzdDw8IiAiPDx2WzBdLnNlY29uZDw8IiAiOwogICAgY291dDw8dlsxXS5maXJzdDw8IiAiPDx2WzFdLnNlY29uZDw8IlxuIjsKICAgIHJldHVybiAwOwp9