def add_vector(point, k, vec):
    return point[0] + k * vec[0], point[1] + k * vec[1]

def func(data1, data2):
    vec1, k1 = data1
vec2, k2 = data2
return add_vector(vec1, k2, vec2), k2
vecs = [(1, 1), (2, 3), (-1, 1)]
scalars = [2, 3, 2]
start = -5, 0
temp = zip([start] + vecs, [1] + scalars)
result = [data[0] for data in accumulate(temp, func)]
print(result)
Cumulative sum of vectors from a point