local w, h, x = io.read("*n", "*n", "*n") if x == 0 then for i = 1, h do print(string.rep("0", w)) end os.exit() end if w == 1 then if h == 1 then if 9 < x then print(-1) else print(x) end elseif h % 3 ~= 2 or 18 < x then print(-1) else local t = {} t[1] = math.min(x, 9) t[2] = x - t[1] for i = 1, h do if i % 3 == 1 then print(t[1]) elseif i % 3 == 2 then print(t[2]) else print(0) end end end os.exit() end if h == 1 then if w % 3 ~= 2 or 18 < x then print(-1) else local t = {} t[1] = math.min(x, 9) t[2] = x - t[1] for j = 1, w do if j % 3 == 1 then io.write(t[1]) elseif j % 3 == 2 then io.write(t[2]) else io.write(0) end end io.write("\n") end os.exit() end if w % 3 ~= 2 or h % 3 ~= 2 or 36 < x then print(-1) os.exit() end do local t = {} for i = 1, 4 do t[i] = math.min(x, 9) x = x - t[i] end for i = 1, h do for j = 1, w do if i % 3 == 1 and j % 3 == 1 then io.write(t[1]) elseif i % 3 == 1 and j % 3 == 2 then io.write(t[2]) elseif i % 3 == 2 and j % 3 == 1 then io.write(t[3]) elseif i % 3 == 2 and j % 3 == 2 then io.write(t[4]) else io.write(0) end end io.write("\n") end end