Program all;
const n =6;var
a: array[1..n,1..n] of integer;
s1,s2,p:integer;
i,j:integer;
beginfor i:=1 to n do
begin
for j:=1 to n do
begin
a[i,j]:=10-random(20);
write(a[i,j],' ');
end;
writeln();
end;
s1:=0;
s2:=0;
for i:= 1 to n do
for j:=1 to n do
s1:=s1+a[i,j];
for i := 1 to n do
for j:= 1 to n do
if i=j then
begin
s2:=s2+a[i,j];
p:=s1*s2;
end;
writeln('p=',p);
readln;
end.