Implemented sumOut method for Factor.java