Uses crt;
const n=4;
var b:array[1..n,1..n] of integer;
i,j,pr,k,t,min:integer;
begin
randomize;
pr:=1;
for i:=1 to n do
for j:=1 to n do
b[i,j]:=random(100)-50;
for i:=1 to n do
begin
for j:=1 to n do
write(b[i,j]:3);
writeln;
end;
writeln;
k:=1;
t:=3;
repeat
for i:=k to k do
for j:=1 to t do
if b[i,j]>0 then pr:=b[i,j]*pr;
inc(k);
t:=t-1;
until k=4;
writeln(pr);
min:=50;
for i:=1 to n do
for j:=2 to 2 do
if b[i,j]writeln(min);
writeln;
b[4,3]:=b[4,3]+b[k,t];
b[k,t]:=b[4,3]-b[k,t];
b[4,3]:=b[4,3]-b[k,t];
for i:=1 to n do
begin
for j:=1 to n do
write(b[i,j]:3);
writeln;
end;
writeln;
end.