Help me in solving NUMREC problem

My issue

why we take long datatypes of n and m ?

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t>0){
		    long n=sc.nextInt();
		    long m=sc.nextInt();
		    
		    long ans= (n*m*(n+1)*(m+1)/4) -(n*m);
		    System.out.println(ans);
		    t--;
		}
	}
}

Learning course: Prepare for your DSA interviews
Problem Link: Practice Problem in - CodeChef

@pdivyansh946
because multiplying it would overflow the integer range value.