Return on Investment (ROI) is calculated by dividing the cumulative proceeds over the original balance:

where proceeds is: