Run error in last two test Cases

I am getting Run error in last two test cases. And my code is also fast. can you please tell me my mistake.

check if there is a division by 0

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

It is stilll showing stackoverflow exception for factorial function. How I can resolve that ?

firstly there is no use of big integer in this question .
secondly break the answer into parts i.e. break n! in parts.
in each step multiply the temp ans to the main answer and take mod repeatedly.
so that the answer doesnt exceed out limit.