The general quadruple point formula