Hazoq just got out of the cave and now he wants to build his house. After he found the perfect piece of land, which can be described as a D array consisting of rows and columns with rows numbered from to (top to bottom) and columns numbered from to (left to right) filled with integers, he decided to follow one of WiederDude's tutorials. But the tutorial was so long and boring, so he's counting on you to summarize the tutorial for him.
The tutorial consists of steps. On the -th step you are given five integers , , , , and you need to place blocks on top of every cell such that:
\sqrt{(x-i)^2+(y-j)^2} \le d.
a_{i, j} is a multiple of .
You have to output a D array consisting of rows and columns, with b_{i, j} being the number of blocks placed on top of the cell after performing all the steps.
Notice that the array is different from the array and it doesn't get affected by the queries.
The first line consists of two integers , (1 \le n \cdot m \le 10^5) — the dimensions of the grid.
The following lines are the description of the array , with the -th line containing integers a_{i, 1}, a_{i, 2}, \ldots, a_{i, m} (0 \le a_{i, j} \le 10^6).
The next line consists of a single integer (1 \le q \le 10^5) — the number of steps.
The next lines each contain five integers , , , , (1 \le x \le n, 1 \le y \le m, 0 \le d \le 10^5, 1 \le c \le 10^6, 1 \le s \le 10^{10}).
The output consists of lines.
The -th line contains integers b_{i, 1}, b_{i, 2}, \ldots, b_{i, m}.
Example 1
Subtask ( points): n \cdot m \le 10^3
Subtask ( points): n = 1
Subtask ( points): c = 1
Subtask ( points): x = 1, y = 1
Subtask ( points): n \cdot m \le 10^4
Subtask ( points): a_i, c \le 1000
Subtask ( points): a_i, c \le 10^5
Subtask ( points): c \le 100
Subtask ( points): No additional constraints.