added cumulative gain at i