program p1;
type tab=array[1..n,1..n] of integer;
var A:tab; SumaDiag,i,j:integer;
begin
write('n:'); readln(n);
writeln('Dati elementele:');
for i:=1 to n do
for j:=1 to n do begin
write('A[,i,',',j,']='); readln(A[i,j]);
end;
SumaDiag:=0;
for i:=1 to n do
for j:=1 to n do if i=j then SumaDiag:=SumaDiag + A[i,j];
for i:=1 to n do
for j:=1 to n do A[i,j]:=A[i,j]+SumaDiag;
end.