Question for Loc May!!! DIRECT SERIES.

I wrote this code for this.
It works fine on my terminal, but i keep getting run-time error when I submit.
Thanks in Advance.

Code:
#include<stdio.h>
#include<stdlib.h>

long long f=1;

long long fact(long long);

int main()
{
long long t;
scanf("%llu",&t);

long long *n;
n=(long long*)calloc(t,sizeof(long long));

long long *m;
m=(long long*)calloc(t,sizeof(long long));

int i;

for(i=0;i<t;i++)
{
	scanf("%llu %llu%*c",(n+i),(m+i));
}

long long *sum;
sum=(long long*)calloc(t,sizeof(long long));

long long j;	
for(i=0;i<t;i++)
{
	for(j=1;j<=n[i];j++)
	{
		sum[i]+=(fact(m[i]+j)/fact(j));
	}
}

for(i=0;i<t;i++)
{
	sum[i]=(sum[i]%1000000007);
	printf("%llu\n",sum[i]);
}
return 0;

}

long long fact(long long x)
{
if(x<1)
return 1;
else
f=x*fact(x-1);

return f;	

}