It's as easy as 1,2,3 (except you have to add them up) Let's consider a list \$L\$ (initially empty) and a pointer \$p\$ into this list (initialized to \$0\$).

Given a pair of integers \$(m,n)\$, with \$m\ge 0\$ and \$n&gt;0\$:


We set all uninitialized values in \$L\$ up to \$p+m+n\$ (excluded) to \$0\$.
We advance the pointer by adding \$m\$ to \$p\$.
We create a vector \$[1,2,...,n]\$ and 'add' it to \$L\$ at the position \$p\$ updated above. More formally: \$L_{p+k} \gets L_{p+k}+k+1\$ for each \$k\$ in \$[0,..,n-1]\$.


We repeat this process with the next pair \$(m,n)\$, if any.

Your task is to take a list of pairs \$(m,n)\$ as input and to print or return the final state of \$L\$.

Example

Input: [[0,3],[1,4],[5,2]]


initialization:

p = 0, L = []

after [0,3]:

p = 0, L = [0,0,0]
         + [1,2,3]
         = [1,2,3]

after [1,4]:

p = 1, L = [1,2,3,0,0]
         +   [1,2,3,4]
         = [1,3,5,3,4]

after [5,2]:

p = 6, L = [1,3,5,3,4,0,0,0]
         +             [1,2]
         = [1,3,5,3,4,0,1,2]



Rules


Instead of a list of pairs, you may take the input as a flat list \$(m_0,n_0,m_1,n_1,...)\$ or as two separated lists \$(m_0,m_1,...)\$ and \$(n_0,n_1,...)\$.
You may assume that the input is non-empty.
The output must not contain any trailing \$0\$'s. However, all intermediate or leading \$0\$'s must be included (if any).
This is code-golf.


Test cases

Input:

[[0,3]]
[[2,3]]
[[0,4],[0,5],[0,6]]
[[0,3],[2,2],[2,1]]
[[0,1],[4,1]]
[[0,3],[1,4],[5,2]]
[[3,4],[3,4],[3,4]]
[[0,1],[1,2],[2,3],[3,4]]
[[2,10],[1,5],[2,8],[4,4],[6,5]]


Output:

[1,2,3]
[0,0,1,2,3]
[3,6,9,12,10,6]
[1,2,4,2,1]
[1,0,0,0,1]
[1,3,5,3,4,0,1,2]
[0,0,0,1,2,3,5,2,3,5,2,3,4]
[1,1,2,1,2,3,1,2,3,4]
[0,0,1,3,5,8,11,14,11,14,17,20,12,0,0,1,2,3,4,5]
Jelly, 12 11 bytes

+ɼ0x;R}ʋ/€S


Try it online!

A full program that takes a list of lists of integers as its argument and returns a list of integers. Can be adapted to work as a link by resetting the register to zero after each call (as implemented in the footer on TIO).

Saved a byte now list can be non-empty.