more general solution