Given an array (or list or vector) of arrays (or, guess what, lists or vectors) of integers, your goal is to return the sum of a specific set of numbers, starting with elements whose position is equal to the main array length and going down by one at each step.

Say for example the parent array (etc, etc) has 3 sub-arrays inside: you should consider the third  element of the first sub-array, the second of the second array and the first element in the third one: `[[3, 2, 1, 0], [4, 6, 5, 3, 2], [9, 8, 7, 4]]` would have you considering `1` for `[3, 2, 1, 0]`, `6` for `[4, 6, 5, 3, 2]` and `9` for `[9, 8, 7, 4]`, which sums up to `16`.

One small note is that not always each sub-array will have enough elements, in which case you should then use a default value (if provided) or `0` (if not provided), as shown in the test cases.

Difficulty: EASY
Starter code: def elements_sum(arr, d=0):
	

Solutions:
def elements_sum(arr, d=0):
	return sum((r[i] if i < len(r) else d for (i, r) in enumerate(reversed(arr))))


def elements_sum(arr, d=0):
	a = len(arr)
	res = 0
	for i in arr:
		if len(i) >= a:
			res += i[a - 1]
		else:
			res += d
		a -= 1
	return res


def elements_sum(arr, d=0):
	return sum((a[i] if len(a) > i else d for (i, a) in enumerate(arr[::-1])))


def elements_sum(arr, d=0):
	lf = len(arr) - 1
	return sum((n[lf - i] if n and len(n) > lf - i else d for (i, n) in enumerate(arr)))


def elements_sum(arr, d=0):
	count = len(arr)
	result = 0
	for i in arr:
		if len(i) >= count:
			result += i[count - 1]
		else:
			result += d
		count -= 1
	return result


def elements_sum(arr, d=0):
	summ = 0
	for i in arr:
		try:
			summ += i[len(arr) - (arr.index(i) + 1)]
		except IndexError:
			summ += d
	return summ


def elements_sum(arr, d=0):
	return sum([d if not arr[x] or len(arr[x]) <= len(arr) - x - 1 else arr[x][len(arr) - x - 1] for x in range(len(arr))])


def elements_sum(arr, *d):
	d = d[0] if d else 0
	c = []
	for (k, v) in enumerate(arr):
		try:
			c.append(arr[k][len(arr) - k - 1])
		except:
			c.append(d)
	return sum(c)