Ever since Kalevitch, a famous Berland abstractionist, heard of fractals, he made them the main topic of his canvases. Every morning the artist takes a piece of graph paper and starts with making a model of his future canvas.他取了一个 n × n 方格那么大的方格,并将其中一些涂成黑色。 Then he takes a clean square piece of paper and paints the fractal using the following algorithm:
步骤1.将纸张分成n2个相同的正方形,并根据模型将其中一些涂成黑色。
步骤2. 每个保持白色的方块被分成n2个更小的方块,并且根据模型将其中一些涂成黑色。
接下来的每个步骤都会重复步骤 2。
Unfortunately, this tiresome work demands too much time from the painting genius. Kalevitch 一直梦想着让这个过程自动化,从而转向制作 3D 甚至 4D 分形。
输入
The first line contains integers n and k (2 ≤ n ≤ 3, 1 ≤ k ≤ 5), where k is the amount of steps of the algorithm.以下 n 行中的每一行都包含确定模型的 n 个符号。象征 ”。”代表白色方块,而“*”代表黑色方块。 It is guaranteed that the model has at least one white square.
输出
Output a matrix nk × nk which is what a picture should look like after k steps of the algorithm.
示例
输入 #1
2 3 .* ..
输出 #1
.******* ..****** .*.***** ....**** .***.*** ..**..** .*.*.*.* ........
输入 #2
3 2 .*. *** .*.
输出 #2
.*.***.*. ********* .*.***.*. ********* ********* ********* .*.***.*. ********* .*.***.*.