Solving an exponential equation with different bases