Fix: sum function to actually add instead of subtract
This MR fixes the sum function that was incorrectly implementing subtraction (a-b) instead of addition (a+b). This resolves the logic error in the function.
The change also adds a basic docstring for clarity.