solve the calculation