I am getting Wrong Answer in Test Case #5 in Problem Facto Sum ( Section Arrays)
Can someone point out where I am wrong? Other test cases are showing correct answer.
#include <bits/stdc++.h>
using namespace std;
int main(){
long long int fact[1001];
int mod[1001];
int i;
fact[0]=0;
fact[1]=1;
for(i=0; i<=1000; i++){
mod[i]= i%107;
}
for(i=2; i<=1000; i++)
{
fact[i]=(fact[i-1]*mod[i]) % 107;
//cout<<i<<" "<<fact[i]<<endl;
}
long long int sum=0;
int n,number;
cin>>n;
while(n--){
cin>>number;
sum=sum+fact[number];
}
sum=sum%107;
cout<<sum<<endl;
return 0;
}