Sequentially Divisible Sometimes to fall asleep, I'll count as high as I can, whilst skipping numbers that are not square-free. I get a little thrill when I get to skip over several numbers in a row - for example, 48,49,50 are all NOT square-free (48 is divisible by 2^2, 49 by 7^2, and 50 by 5^2).

This led me to wondering about the earliest example of adjacent numbers divisible by some arbitrary sequence of divisors.

Input

Input is an ordered list a = [a_0, a_1, ...] of strictly positive integers containing at least 1 element.

Output

Output is the smallest positive integer n with the property that a_0 divides n, a_1 divides n+1, and more generally a_k divides n+k. If no such n exists, the function/program's behavior is not defined.

Test Cases

[15] -&gt; 15
[3,4,5] -&gt; 3
[5,4,3] -&gt; 55
[2,3,5,7] -&gt; 158
[4,9,25,49] -&gt; 29348
[11,7,5,3,2] -&gt; 1518


Scoring

This is code-golf; shortest result (per language) wins bragging rights. The usual loopholes are excluded.
Wolfram Language (Mathematica), 51 bytes

Mod[ChineseRemainder[1-Range@Length@#,#],LCM@@#,1]&amp;


Try it online!