Compute $N! \ \mathrm{mod}P$ , where $N<=10^9$ and $P=10^9+7$, where $N!$ is $N$ factorial

736 Views Asked by At

I have seen several web pages which mention that this task can be done efficiently using FFT. But, I didn't find any reliable source which can help me understand the process underneath. It will be great in case someone can help in the computation of factorial of $N$ modulo $(10^9+7)$.