const xn=100; const xm=100;var x: array [1..xn, 1..xm] of integer; n, m,i,j,r: integer;
begin write('Введите n');Read(n);write('Введите m');Read(m);for i := 1 to n do beginfor j := 1 to m do beginif ((i = 1) or (i = n)or (j = m) or (j = 1)) thenwrite(0:3,' ')else beginif (((i mod 2) = 0)or((j mod 2) = 0))thenwrite((i*i+j*j):3,' ')else beginr:= Round(Random()*15 - 5);write((r):3,' ');end;end;end; Writeln; end;end.