var m,n,i,j,p_i,p_j,hight:integer;
canvas:array[0..800,0..360]of char;
i_c,j_c:array[0..800] of boolean;
procedure drawVertex(x,y:integer);
begin
canvas[x,y]:='+';
canvas[x+4,y]:='+';
canvas[x,y+3]:='+';
canvas[x+4,y+3]:='+';
canvas[x+2,y+5]:='+';
canvas[x+6,y+5]:='+';
canvas[x+6,y+2]:='+';
end;
procedure drawEdge(x,y:integer);
var i:integer;
begin
for i:=y+1 to y+2 do
begin
canvas[x,i]:=chr(124);
canvas[x+4,i]:=chr(124);
end;
for i:=y+3 to y+4 do canvas[x+6,i]:=chr(124);
for i:=x+1 to x+3 do
begin
canvas[i,y]:='-';
canvas[i,y+3]:='-';
end;
for i:=x+3 to x+5 do canvas[i,y+5]:='-';
canvas[x+1,y+4]:='/';
canvas[x+5,y+4]:='/';
canvas[x+5,y+1]:='/';
end;
procedure drawFace(x,y:integer);
var i,j:integer;
begin
for i:=y+1 to y+2 do
for j:=x+1 to x+3 do canvas[j,i]:=' ';
for j:=x+2 to x+4 do canvas[j,y+4]:=' ';
for i:=y+2 to y+3 do canvas[x+5,i]:=' ';
end;
procedure draw(x,y,h:integer);
var o,p,q:integer;
begin
for p:=x to x+6 do j_c[p]:=true;
for o:=1 to h do
begin
for q:=3*o-3+y to 3*o+2+y do i_c[q]:=true;
drawVertex(x,3*o-3+y);
drawEdge(x,3*o-3+y);
drawFace(x,3*o-3+y);
end;
end;
begin
// assign(input,'drawingu.in'); reset(input);
// assign(output,'drawingu.out'); rewrite(output);
readln(m,n);
fillchar(canvas,sizeof(canvas),'.');
fillchar(i_c,sizeof(i_c),false);
fillchar(j_c,sizeof(j_c),false);
for i:=m downto 1 do
for j:=1 to n do
begin
read(hight);
draw(2*i-1+4*j-4,2*i-1,hight);
end;
p_i:=3*m+3; p_j:=4*n+3;
while i_c[p_i+1] do inc(p_i);
while j_c[p_j+1] do inc(p_j);
for i:=p_i downto 1 do
begin
for j:=1 to p_j do write(canvas[j,i]);
writeln;
end;
// close(input); close(output);
end.