Let us define the "multiplicative deltas" of values \$[\; a_0, \cdots a_N, \;]\$ as:
$$ [\; a_1 / a_0, \cdots, a_{i+1} / a_i, \cdots, a_N / a_{N-1} \;] $$
The reverse operation - namely "multiplicative undelta" - returns values such that the above operation results in the given values.
Example
Given values \$[\; 1, 5, 3, 2 \;]\$ a general solution to the "multiplicative undelta" operation is:
$$ [\; a_0, \quad \underset{a_1}{\underbrace{a_0 \cdot 1}}, \quad \underset{a_2}{\underbrace{a_1 \cdot 5}}, \quad \underset{a_3}{\underbrace{a_2 \cdot 3}}, \quad \underset{a_4}{\underbrace{a_3 \cdot 2}} \;] $$
A particular solution can be obtained by setting \$a_0\$ to any value other than zero, for example by setting \$a_0 := 1 \$ we would get:
$$ [\; 1, 1, 5, 15, 30 \;] $$
Challenge
Your task for this challenge is to implement the operation "multiplicative undelta" as defined above.
Rules
Inputs are:
- a non-zero value \$a_0\$
- a non-empty list/array/vector/... of non-zero "multiplicative deltas"
Output is a list/array/vector/... of values such that the first element is \$a_0\$ and for which the "multiplicative deltas" are the input.
Note: If your language has no support of negative integers you may replace non-zero by positive.
Test cases
2 [21] -> [2,42]
1 [1,5,3,2] -> [1,1,5,15,30]
-1 [1,5,3,2] -> [-1,-1,-5,-15,-30]
7 [1,-5,3,2] -> [7,7,-35,-105,-210]
2 [-12,3,-17,1311] -> [2,-24,-72,1224,1604664]
-12 [7,-1,-12,4] -> [-12,-84,84,-1008,-4032]
1 [2,2,2,2,2,2,2,2] -> [1,2,4,8,16,32,64,128,256]