Implemented remainderSum, Remainder and Gain