large factorial with mod

i am practicing question HAR001 Problem - CodeChef, i get WA and when i check others answer i realized that during factorial, it use %(mod-1) instead of %mod, as per image Imgur: The magic of the Internet
What are the reason behind it?

1 Like