program xmz;
var
a:array[-100..100,-100..100]of boolean;
x:array[-100..100]of boolean;
y:array[-100..100]of boolean;
n,k,aa:longint;
s:int64;
f1,f2:text;
procedure dfs(kk:integer);
var i,j:integer;
begin
for i:=-n to n do
for j:=-n to n do
if (not x[i])and(not y[j])and(abs(i)+abs(j)<=n) then
begin
x[i]:=true;y[j]:=true;
if kk>1 then dfs(kk-1) else s:=s+1;
x[i]:=false;y[j]:=false;
end;
end;
begin
assign(f1,'empire.in');assign(f2,'empire.out');
reset(f1);rewrite(f2);
read(f1,n,k);n:=n-1;s:=2;
if (n*k<=24) then begin dfs(k);for aa:=1 to k do s:=trunc(s/aa);end
else if k=2*n then for aa:=1 to n do s:=s*2 else s:=0;
write(f2,s mod 504);
close(f1);close(f2);
end.