const u=1020847;
var
m,p:integer;
d,n,i:longint;
a:array[1..2000] of longint;
BEGIN
{vhod----}
read(m);
readln(p);
{--------}
{found br---}
a[1]:=1;
for i:=2 to (m) do
begin
a[i]:=(a[i-1]*i);
end;
n:=a[m];
d:=n div (m);
write(d mod u);
END.
