anybody please tell me where m getting wrong..
i hv used begger's method.
here is my code..
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#define mod 10000007LL
using namespace std;
long long int fact(long long int n){
long long ft=1,c=1;
if(n==1 || n==0)
return 1LL;
for(int i=1;i<=n;i++){
c=c*i;
if(i%4==0){
c=c%mod;
ft=ft*c;
ft=ft%mod;
c=1;
}
if(i==n)
{
ft=ft*c;
ft=ft%mod;
}
}
return ft;
}
int main(){
long long int n,r,ans=1;
scanf("%lld%lld",&n,&r);
if(n<r)
ans= -1LL;
else if(n==r)
ans= 1LL;
else if(n>r){
n=n-r;
ans= fact(n+r-1)/((fact(r-1)*fact(n))%mod);
}
printf("%lld\n",ans);
return 0;
}