specialized sum function