Fast maxSubProduction algorithm