Update the minimum value such than it should be greater than 0
if ( minVal [ a ] >= 0 and minVal [ b ] >= 0 ) : NEW_LINE INDENT minVal [ b ] = min ( minVal [ a ] , minVal [ b ] ) NEW_LINE DEDENT elif ( minVal [ a ] >= 0 and minVal [ b ] < 0 ) : NEW_LINE INDENT minVal [ b ] = minVal [ a ] NEW_LINE DEDENT elif ( minVal [ a ] < 0 and minVal [ b ] >= 0 ) : NEW_LINE INDENT minVal [ b ] = minVal [ b ] NEW_LINE DEDENT else : NEW_LINE INDENT minVal [ b ] = max ( minVal [ a ] , minVal [ b ] ) NEW_LINE DEDENT