#include
int main()
{int i,j,s1,s2,a[5][5]={0};
for(i=s1=s2=0;i<4;i++)
{for(j=0;j<4;j++)
{scanf("%d",&a[i][j]);
a[i][4]+=a[i][j];
a[4][j]+=a[i][j];
}
s1+=a[i][i];
s2+=a[i][4-i];
}
printf("\n");
for(i=0;i<5;i++)
{for(j=0;j<5;j++)
{printf("%3d",a[i][j]);
if(j==3)
if(i==4)break;
else printf(" ");
}
printf(i==3?"\n\n":"\n");
}
printf("主对角线之和=%d\n",s1);
printf("次对角线之和=%d\n",s2);
return 0;
}