generalized sum formula to ereals