program _________b;
 const
       cubic:array[1..6,1..7]of char=(
                                      (#0 , #0 , '+', '-', '-', '-', '+'),
                                      (#0 , '/', ' ', ' ', ' ', '/', '|'),
                                      ('+', '-', '-', '-', '+', ' ', '|'),
                                      ('|', ' ', ' ', ' ', '|', ' ', '+'),
                                      ('|', ' ', ' ', ' ', '|', '/', #0 ),
                                      ('+', '-', '-', '-', '+', #0 , #0 )
                                     );
 var
     f:text;
     i,j,k,M,N: longint;
     a:array[1..40,1..40] of integer;
     pole:array[-10..9*40+1,-10..9*40+1]of char;
     maxh:longint;
     minx,miny,maxx,maxy:longint;

 procedure draw(w,h,d:word);
  var
      curx,cury:longint;
      i,j,k:longint;
      x,y:longint;
  begin
    curx:=4*w+2*d+1;
    cury:=3*h+2*d+1;

    for i:=1 to 6 do
      for j:=1 to 7 do
       begin
         x:=curx+j+1;  y:=cury+i+1;
         if (cubic[7-i,j]<>#0) then pole[x,y]:=cubic[7-i,j];
         if x<minx then minx:=x;if x>maxx then maxx:=x;
         if y<miny then miny:=y;if y>maxy then maxy:=y;
       end;
  end;

 begin
   maxh:=0;
   minx:=$FFFF;maxx:=$0;miny:=$FFFF;maxy:=$0;

   for i:=0 to 9*40+1 do
     for j:=0 to 9*40+1 do pole[i,j]:='.';

   assign(f,'input.txt');
   reset(f);
   read(f,N,M);
   for i:=N downto 1 do
    begin
      for j:=1 to M do
       begin
         read(f,a[i,j]);
         if a[i,j]>maxh then maxh:=a[i,j];
       end;
     end;
   close(f);

   for i:=1 to maxh do
     for j:=N downto 1 do
       for k:=1 to M do
        begin
          if a[j,k]>0 then
           begin
             dec(a[j,k]);draw(k,i,j);
           end;
        end;

   assign(f,'output.txt');
   rewrite(f);
   for i:=maxy downto miny do
    begin
      for j:=minx to maxx do write(f,pole[j,i]);
      writeln(f);
    end;
   close(f);
 end.
