A list of integers is given. Then $Q$ operations follow, each a position $i$ and a value $x$ (position always valid, $0 \le i \le$ current length). Insert $x$ at position $i$ for each operation and print the final list as a Python list literal.
Input
Line 1: the list. Line 2: $Q$. Next $Q$ lines: i x.
Output
Print the resulting list.
Example 1
Input
10 20 30 3 0 5 2 15 5 40
Output
[5, 10, 15, 20, 30, 40]
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.