Recursive function that multiply a number by repeated sums.