convert the negative value to positive .
if ( a < 0 ) : NEW_LINE INDENT a = a * ( - 1 ) ; NEW_LINE DEDENT if ( b < 0 ) : NEW_LINE INDENT b = b * ( - 1 ) ; NEW_LINE DEDENT return int ( ans / math . gcd ( a , b ) ) ; NEW_LINE