No description, literally. I'm tired.
_(:3∠」)_
You have a sequence a. Initially, a has exactly one integer. You're at the place of the 1st element.
There are some operations below:
insert <val1> <val2>: insert <val2> number of elements, all with value <val1>. Insert them next to your position.
erase <val>: erase <val> number of elements next to you.
move <value>: Move <value> number of indexes forward. Note that <value> might be negative, which means you might move forward or backward.
show: Start from your position, output the sequence a. Each element separated by a space. Note that there should be no space at the end but a '\n'.
For example: a = {2}, and execute operations below:
insert 3 6 // a = {2,3,3,3,3,3,3}, you're at the 1st position.
insert 1 1 // a = {2,1,3,3,3,3,3,3}, you're at the 1st position.
erase 2 // a = {2,3,3,3,3,3}, you're at the 1st position. Erase 1 and 3.
move 5 // a = {3,2,3,3,3,3}, you're at the 1st position. Originally was the 6th position.
erase 3 // a = {3,3,3}, you're at the 1st position. Erase the first 2 and two 3.
show // print 3 3 3. Note that there should be a '\n' at the end.
The first line contains an integer x, indicates the first element in a.
The next line contains an integer n, indicates the number of operations.
There are n lines below. Each line contains exactly one operation.
1 <= n <= 3000. All numbers in a are in int range. We guaranteed that there must be at least 1 element in a, and the number of insert and erase elements won't exceed 3000.
Also, the total elements of a won't exceed 3000.
Output the correct a if there's show operation.