In your class, you have started lessons about "arithmetic progression". Because you are also a programmer, you have decided to write a function.

This function, arithmetic_sequence_sum(a, r, n), should return the sum of the first (n) elements of a sequence in which each element is the sum of the given integer (a), and a number of occurences of the given integer (r), based on the element's position within the sequence.

For example:

arithmetic_sequence_sum(2, 3, 5) should return 40:

```
1     2        3          4            5
a + (a+r) + (a+r+r) + (a+r+r+r) + (a+r+r+r+r) 
2 + (2+3) + (2+3+3) + (2+3+3+3) + (2+3+3+3+3) = 40
```

Difficulty: EASY
Starter code: def arithmetic_sequence_sum(a, r, n):
	

Solutions:
def arithmetic_sequence_sum(a, r, n):
	return n * (a + a + (n - 1) * r) / 2


def arithmetic_sequence_sum(a, r, n):
	result = 0
	for i in range(n):
		result += a + i * r
	return result


def arithmetic_sequence_sum(a, r, n):
	return sum((a + r * x for x in range(n)))


def arithmetic_sequence_sum(a, r, n):
	b = a
	x = n - 1
	while x != 0:
		a += r
		x -= 1
	return n * (b + a) / 2


def arithmetic_sequence_sum(a, r, n):
	return sum((a + sum((r for _ in range(i))) for i in range(n)))