Const
N = 3;
M = 4;
Var
A:array[0..N-1,0..M-1] of integer;
i,j,k:integer;
Begin
For i:= 0 to N-1 do
For j:= 0 to M-1 do
if i*j = 0 then A[i,j]:=1;
if M>N then k:=M
else k:=N;
For k:= 1 to k-1 do
For i:= 1 to N-1 do
For j:= 1 to M-1 do
if (i = k)or(j = k) then
A[i,j]:=A[i-1,j]+A[i,j-1];
For i:= 0 to N-1 do
For j:= 0 to M-1 do
Write(A[i,j],' ');
End.