#include <iostream>
using namespace std;
int main(){
int n,i,j,a[101][101],z1=0,z2=0,z3=0,z4=0;
cout<<"Introduceti dimensiunea matricii:";
cin>>n;
cout<<"Introduceti matricea: \n";
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cin>>a[i][j];
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(j>i&&i+j<n+1){
z1=z1+a[i][j];
}
else if(i>j&&i+j<n+1){
z2=z2+a[i][j];
}
else if(j>i&&i+j>n+1){
z3=z3+a[i][j];
}
else if(i>j&&(i+j)>(n+1)){
z4=z4+a[i][j];
}
}
}
cout<<"z1="<<z1<<endl;
cout<<"z2="<<z2<<endl;
cout<<"z3="<<z3<<endl;
cout<<"z4="<<z4<<endl;
return 0;
}