Simplifying expressions with different bases