uses Crt;
const
n = 3;
var
a: array[1..n, 1..n] of integer;
i, j, s: integer;
begin
ClrScr;
for i := 1 to n do
for j := 1 to n do
Read(a[i, j]);
s := 0;
for i := 1 to n do
begin
for j := 1 to n do
begin
Write(a[i, j]:5);
if i = j then s := s + a[i, j]
end;
Writeln
end;
Writeln('s=', s);
ReadKey
end.