public static int countPairs(int N, int M)   {
        int totalNumber = 0;
        for(int i=1;i<=N;i++){
            for(int j=1;j<=M;j++)  {
                if(isInt(i,j)){
                    totalNumber++;
                }
            }
        }
        return totalNumber;
    }