Added a check for negatives to choose smaller exponent value for substitution.
Added a check for negatives to choose smaller exponent value for substitution.

kaushik94/sympy,kaushik94/sympy,kaushik94/sympy