Write a function that takes an array/list of numbers and returns a number such that 

Explanation
total([1,2,3,4,5]) => 48

1+2=3--\ 3+5 =>     8 \
2+3=5--/ \            ==  8+12=>20\     
          ==>5+7=> 12 / \           20+28 => 48
3+4=7--\ /            == 12+16=>28/
4+5=9--/ 7+9 =>     16  /


if total([1,2,3]) => 8 then 


first+second => 3 \
                   then 3+5 => 8
second+third => 5 /


### Examples
```python
total([-1,-1,-1]) => -4
total([1,2,3,4])  => 20
```

**Note:** each array/list will have at least an element and all elements will be valid numbers.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Mathematics

Starter code: def total(arr):
	

Solutions:
def total(arr):
	while len(arr) > 1:
		arr = [x + y for (x, y) in zip(arr, arr[1:])]
	return arr[0]


def total(arr):
	from math import factorial as fact
	choose = lambda a, b: fact(a) / (fact(a - b) * fact(b))
	return sum((choose(len(arr) - 1, i) * v for (i, v) in enumerate(arr)))


def total(xs):
	return xs[0] if len(xs) == 1 else total([xs[i] + x for (i, x) in enumerate(xs[1:])])


def total(arr):
	if len(arr) == 1:
		return arr[0]
	arr2 = []
	for i in range(len(arr) - 1):
		arr2.append(arr[i] + arr[i + 1])
	return total(arr2)


def total(arr):
	while len(arr) > 2:
		arr = [x + y for (x, y) in zip(arr, arr[1:])]
	return sum(arr)


total = lambda a: a[0] if len(a) == 1 else total([a[i] + a[i + 1] for i in range(len(a) - 1)])


from math import factorial as fac

def C(n, k):
	return fac(n) // (fac(k) * fac(n - k))

def total(arr):
	l = len(arr)
	return sum((arr[i] * C(l - 1, i) for i in range(l)))


def total(arr):
	a = arr[:]
	for i in range(len(a), 1, -1):
		for j in range(1, i):
			a[j - 1] += a[j]
	return a[0]