implemented sumSlice