I\'m trying to calculate two cumulative sums given a series of financial transactions. There are 4 transactions types, each with an amount for the transaction: D - deposit W