Calculating the base and exponent