import java.util.*;
import java.lang.*;
import java.io.*;

public class dd
{
	public static void main(String[] args) throws IOException
	{
		String [] pis = new String[10];
		pis[1]="    +    |    |    +    |    |    +";
		pis[2]="+---+    |    |+---+|    |    +---+";
		pis[3]="+---+    |    |+---+    |    |+---+";
		pis[4]="+   +|   ||   |+---+    |    |    +";
		pis[5]="+---+|    |    +---+    |    |+---+";
		pis[6]="+---+|    |    +---+|   ||   |+---+";
		pis[7]="+---+    |    |    +    |    |    +";
		pis[8]="+---+|   ||   |+---+|   ||   |+---+";
		pis[9]="+---+|   ||   |+---+    |    |+---+";
		pis[0]="+---+|   ||   |+   +|   ||   |+---+";
		
		Scanner sc = new Scanner(System.in);
		String line;
		int[] znak = new int[4];
		try
		{
			do
			{
				line = sc.nextLine();	
				//System.out.println(line.substring(0,2));		
				if(line.substring(0,2)=="en") break;
				 znak[0] = new Integer(line.substring(0,1));
				znak[1] = new Integer(line.substring(1,2));
				znak[2] = new Integer(line.substring(3,4));
				znak[3] = new Integer(line.substring(4,5));
				//System.out.print(znak[0]+","+pis[1].substring(0,5)+"  ");
				for(int i = 0; i<7;i++)
				{				
					System.out.print(pis[znak[0]].substring(i*5,(i*5+5))+"  ");
					System.out.print(pis[znak[1]].substring(i*5,(i*5+5))+"  ");
					if ((i == 2) || (i==4))
					{
						System.out.print("o  ");
					}
					else
					{
						System.out.print("   ");
					}
					System.out.print(pis[znak[2]].substring(i*5,(i*5+5))+"  ");
					System.out.println(pis[znak[3]].substring(i*5,(i*5+5)));
				}
				System.out.println();
				System.out.println();
			} while(1==1);
			System.out.println("end");			
		}
		catch(Exception e)
		{
			System.out.println("end");
		}
		//int pocet = Integer.parseInt(line);		
		
	}
}
