In this problem, we will consider a simple two-dimensional heat transfer model. We start by assuming that we have some rectangular room of dimension n×m which we divide into a grid. Let's call the cell on the ith row and the jth column as (i,j). Inside the grid, we will randomly scatter a handful of heaters. The initial temperature of the cell(i,j) is denoted by T0ij which is 1 units if there is a heater, 0 units otherwise. At every step in time, there is some heat flow between a cell and its neighbours. The update equation of temperature of cells (i,j) at time step z→z+1 looks as
In the equation for updating the cell’s temperature, the constant k simply represents the rate at which heat flows. The neighbors of cell (i,j) are the cells which shares a side with cell (i,j) i.e we consider only four neighbors (top, bottom, left, right).
Given the initial temperature of cells in the grid, Can you tell the temperature of cells after x time steps. Since the temperature of cells can be very large output the temperature modulo 109+7.
Constraints:
Input Format:
The first line contains four space-separated integers n,m,k, and x.
Next n lines contain m integers jth interger in ith line is T0ij. The initial temperature of cell (i,j).
Output Format:
Output n lines, each containing m integer. jth interger in ith line denotes the temperature of cell (i,j) after x time steps.
Note: The above figure explains the sample test case.