The first line of input contains three integers $n, m, q$ $(1 \le n,m,q \le 400, 1\le n \times m \le 400)$, indicating the number of rows and columns of the grid, and the number of events.
For the next $n \times m$ lines, the $((i-1)\times m+j)$-th line contains $4$ integers $p_{ij0},\ p_{ij1}, p_{ij2}, p_{ij3}$ $(0\leq p_{ij0}, p_{ij1}, p_{ij2}, p_{ij3}< 1,000,000,007)$, indicating the probabilities for the pony that locates at $(i, j)$ to move up, down, left, and right. The probabilities are given in the form of modulo $1,000,000,007$. That is, if the probability is $P/Q$, then the given integer is $P\cdot Q^{-1}\pmod {1,000,000,007}$, where $Q^{-1}$ denotes the multiplicative inverse of $Q$ modulo $1,000,000,007$. It's guaranteed that $p_{ij0}+p_{ij1}+p_{ij2}+p_{ij3}\equiv 1 \pmod{1,000,000,007}$.
For the next $m$ lines, each line represents an event.
- $1\ x\ y\ p_0\ p_1\ p_2\ p_3$, indicating that the four probabilities of the gird $(x, y)$ will be changed to $p_0\ p_1\ p_2\ p_3$. $(1\leq x\leq n, 1\leq y\leq m, 0\leq p_0, p_1, p_2, p_3<1,000,000,007, p_0+p_1+p_2+p_3 \equiv 1 \pmod{1,000,000,007})$
- $2$, indicating to query the sum of the mathematical expectation of the time for each pony to move out of the area.