sumSlice function completed