Rotate

No attempts yetTime limit1sMemory limit128 MB

Problem

Sang-geun and Jeong-in invented a new game called Rotate.

First, Jeong-in thinks of a sequence of length $N$. He then splits the sequence into sections that each hold $K$ numbers ($K$ divides $N$). The first section holds the first $K$ numbers of the sequence, the second section holds the next $K$ numbers, and the remaining sections are filled the same way.

Jeong-in may apply the following two operations to the sequence.

  1. Rotate every section to the left or right by $X$ positions.
  2. Rotate the entire sequence to the left or right by $X$ positions.

Because operation 2 acts on the whole sequence, it may change which numbers belong to each section.

Jeong-in applies these operations to his sequence in order and then shows the final sequence to Sang-geun. Given the final sequence and the operations Jeong-in applied, in order, write a program that recovers the sequence Jeong-in originally thought of.

Input

The first line contains the length of the sequence $N$, the section size $K$, and the number of operations Jeong-in applied $Q$ ($1 \le N, K, Q \le 100{,}000$, and $K$ divides $N$).

Each of the next $Q$ lines describes one operation, in order. Each line contains an integer $A$ ($1 \le A \le 2$) indicating the operation type, followed by an integer $X$ ($-100{,}000 \le X \le 100{,}000$) indicating how far to rotate. A negative $X$ rotates to the left and a positive $X$ rotates to the right.

The last line contains the final sequence after all operations have been applied, separated by spaces.

Output

Print the sequence Jeong-in originally thought of on the first line, separated by spaces.