You keep a savings jar that already holds start coins. In week 1 you drop in first coins. Every week after that you drop in step more coins than the week before. Write savings_jar(start, first, step, weeks) that returns how many coins are in the jar after weeks weeks.
Examples
Input: start = 10, first = 5, step = 2, weeks = 3
Output: 31
Explanation: 10 + 5 + 7 + 9 = 31
Input: start = 0, first = 1, step = 1, weeks = 4
Output: 10
Explanation: 1 + 2 + 3 + 4 = 10
Constraints
0 <= start, first, step <= 10000 <= weeks <= 10**5
Goals
- Simulate a week-by-week process with a loop
- Update two variables (the deposit and the total) each step