See below
Now, implement the true block and the false block. One adds the current entry to the sum of negatives, the other adds it to the sum of positives.
Check that you don't have the blocks confused. This is a frequent mistake.
Fill in the blanks.