m@main=getLine>>=print.f.reads>>m f[(n,x)]=product[n,n-length x..1]