uses
crt;
const
str=4;
col=4;
var
a:array [1..str,1..col] of real;
i,j,pc,oc,temp:integer;
sr,summ:real;
begin
clrscr;
oc:=0;
pc:=0;
writeln('------:');
for i:=1 to str do
begin
for j:=1 to col do
begin
a[i,j]:=random(8)-4;
if a[i,j]>0 then
inc(pc)
else
if a[i,j]<0 then
inc(oc);
summ:=summ+a[i,j];
write(a[i,j]:4:0,' ')
end;
writeln
end;
sr:=summ/(str*col);
if oc>pc then
begin
for i:=1 to str do
for j:=1 to col do
a[i,j]:=a[i,j]+sr;
writeln('-------:');
for i:=1 to str do
begin
for j:=1 to col do
write(a[i,j]:6:2,' ');
writeln
end
end
else
writeln('!')
end.