SGARDEN wrong answer

link of my solution CodeChef: Practical coding for everyone
getting wrong answer

ans*=j*p[j]; // this can overflow.

You need to take modulo at each intermediate step.