Done implementing SUM function. Fixed overflow problem, works fine.