 # INLO21 - Editorial

Author: RAVIT SINGH MALIK
Editorialist: RAVIT SINGH MALIK

CAKEWALK

### PREREQUISITES:

Math,Implementation

### PROBLEM:

Total numbers of rectangles in a N \times M grid.

### EXPLANATION:

The Total numbers of rectangles in a N \times M grid is ans = ((m \times (m+1))/2) \times ((n \times (n+1))/2);

ans=ans%1000000007;

For example :
if you need to find total number of rectangles in a 6 \times 10 grid.
a=6 \times (6+1)
a=a/2
b=10 \times (10+1)
b=b/2
ans=a \times b
ans= 21 \times 55
ans=1155
ans=ans%1000000007;
ans=1155

### AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

### RELATED PROBLEMS:

#include<stdio.h>
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d\n%d",&a,&b);
a=(a*(a+1))/2;
b=(b*(b+1))/2;
printf("%d\n"a*b);
}

#include<stdio.h>
int main()
{
int m,n,t,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{int ans=0;
scanf("%d %d",&m,&n);
ans=((m*(m+1))/2)((n(n+1))/2);
ans=ans%1000000007;
printf("%d\n",ans);
}
return 0;
}

#include<stdio.h>
int main()
{
int i,t,m,n;
scanf("%d\n",&t);
for(i=0;i<t;i++)
{
scanf("%d\n%d\n",&m,&n);
int ans=0;
ans=((m*(m+1))/2)((n(n+1))/2);
ans=ans%1000000007;
printf("%d\n",ans);
}
return 0;
}

#include<stdio.h>
#include<math.h>
{
int t,m,n,i,ans;
scanf("%d\n",&t);
for(i=1;i<=t;i++)
{
scanf("%d\n%d",&m,&n);
ans=((m*(m+1))/2)((n(n+1))/2);
ans=ans%1000000007;
printf("%d\n",ans);
}
}

include<stdio.h>
include<math.h>
{ int t,m,n,i,ans; scanf("%d\n",&t); for(i=1;i<=t;i++) { scanf("%d\n%d",&m,&n); ans=((m(m+1))/2)((n*(n+1))/2); ans=ans%1000000007; printf("%d\n",ans); } }

#include<stdio.h>
#include<math.h>
int main()
{
int t,m,n,i,ans;
scanf("%d\n",&t);
for(i=1;i<=t;i++)
{
scanf("%d\n%d",&m,&n);
ans=0;
ans=((m*(m+1))/2)((n(n+1))/2);
ans=ans%1000000007;
printf("%d\n",ans);
}
return 0;
}

# include

int main()
{
int n,i,a,b,ans;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
scanf("%d\n",&a,&b);
}
a=(a(a+1))/2;
b=(b(b+1))/2;
ans=a*b;
ans=ans%1000000007;
printf("%d\n",ans);
}

#include<stdio.h>
#include<math.h>
int t,m,n,i,ans;
scanf("%d\n",&t);
for(i=1;i<=t;i++)
{
scanf("%d\n%d",&m,&n);
ans=((m(m+1))/2)((n*(n+1))/2);
ans=ans%1000000007;
printf("%d\n",ans);
}
}

#include<stdio.h>
#include<math.h>
int main()
{
int ans,a,m,n,p,q,i;
scanf("%d%d",&m,&n);
scanf("%d",a);
for(i=0;i<a;i++)
{
ans=0;
p=(m*(m+1));
p=p/2;
q=(n*(n+1));
q=q/2;
ans=p*q;
ans=ans%1000000007;
printf("%d\n",ans);
}
return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
int a,b,n,i,ans;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
scanf("%d%d\n",&a,&b);
}
a=(a(a+1))/2;
b=(b(b+1))/2;
ans=a*b;
ans=ans%1000000007;
printf("%d\n",ans);
}

#include<stdio.h>
int main()
{
int t,m,n;
scanf("%d",t);
long long int result;
while(t–)
{
scanf("%d",m);
scanf("%d",n);
result = (m*(m+1)nn(n+1)/4)%1000000007;
printf("%lld",result);
}
return 0;
}

#include<stdio.h>
int main() {
int n,i,a,b
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%d\n%d",&a,&b);
a=(a(a+1))/2;
b=(b(b+1))/2;
printf("%d\n"a*b);
}
return 0;
}