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