# Getting wrong ans because of improper placements of modulo. Need Help

I need To Find The Summation Of the Below Series:
(n+1-1)C1+(n+2-1)C2+…+(n+k-1)CK(Hint:(n+k-1)Ck=(n+k-1)C(K)+(n+k-1)C(k-1))
The ans should be printed as Modulo m

Here n=Len and k=N and m=1000003

`````` #include<stdio.h>

#define M 1000003

int main(){

int t=0;

long long int sum=0,L,R,N,init=0,i=0,Len=0;

scanf("%d",&t);

while(t-- > 0){

scanf("%lld%lld%lld",&N,&L,&R);

Len=R-L+1;

if(R==L){

printf("%lld\n",N%M);
}

else if(N<=Len){

init=Len%M;

sum=init;

for(i=2;i<=N;i++){
//I think beacuse of improper placements of modulo m getting wromg ans
init=((((init%M)*((Len%M+i%M-1)%M))%M)/(i%M))%M;

//printf("%lld",init);
sum=(sum%M+init%M)%M;
}

printf("%lld\n",sum);

sum=0;
}

}
//getch();

return 0;
``````

}
I am getting wrong ans because of improper placements of modulo

@aniruddha_paul: I see that you have participated in the April’15 long contest and this post is a clear violation of the contest rule. Please, remove the post.
In case you need help you can always google it or else wait for the editorials to come.