Var
i,j,n,m:integer;
s:real;
a:array[0..1000,1..1000] of real;
begin
readln(n,m);
randomize;
s:=0;
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(10);
s:=s+a[i,j];
write(a[i,j],' ')
end;
writeln
end;
s:=s/n/m;
writeln;
for j:=1 to m do
begin
for i:=1 to n do a[0,j]:=a[0,j]+a[i,j];
a[0,j]:=a[0,j]/n;
if a[0,j] end
end.