If no answer found return - 1
var ans = - 1 ; while ( start <= end ) { var mid = parseInt ( ( start + end ) / 2 ) ; var value = B * mid ; var divB = mid - 1 ; var divA = parseInt ( value % A === 0 ? value / A - 1 : value / A ) ; var divC = parseInt ( value % C === 0 ? value / C - 1 : value / C ) ; var divAB = parseInt ( value % lcm ( A , B ) === 0 ? value / lcm ( A , B ) - 1 : value / lcm ( A , B ) ) ; var divBC = parseInt ( value % lcm ( C , B ) === 0 ? value / lcm ( C , B ) - 1 : value / lcm ( C , B ) ) ; var divAC = parseInt ( value % lcm ( A , C ) === 0 ? value / lcm ( A , C ) - 1 : value / lcm ( A , C ) ) ; var divABC = parseInt ( value % lcm ( A , lcm ( B , C ) ) === 0 ? value / lcm ( A , lcm ( B , C ) ) - 1 : value / lcm ( A , lcm ( B , C ) ) ) ;