

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

public class dd
{
	
	static String[][] c = new String[10][7];
	
	
	
	public static void main(String[] args) throws Exception
	{
		c[0][0] = "+---+";
		c[0][1] = "|   |";
		c[0][2] = "|   |";
		c[0][3] = "+   +";
		c[0][4] = "|   |";
		c[0][5] = "|   |";
		c[0][6] = "+---+";

		c[1][0] = "    +";
		c[1][1] = "    |";
		c[1][2] = "    |";
		c[1][3] = "    +";
		c[1][4] = "    |";
		c[1][5] = "    |";
		c[1][6] = "    +";

		c[2][0] = "+---+";
		c[2][1] = "    |";
		c[2][2] = "    |";
		c[2][3] = "+---+";
		c[2][4] = "|    ";
		c[2][5] = "|    ";
		c[2][6] = "+---+";

		c[3][0] = "+---+";
		c[3][1] = "    |";
		c[3][2] = "    |";
		c[3][3] = "+---+";
		c[3][4] = "    |";
		c[3][5] = "    |";
		c[3][6] = "+---+";

		c[4][0] = "+   +";
		c[4][1] = "|   |";
		c[4][2] = "|   |";
		c[4][3] = "+---+";
		c[4][4] = "    |";
		c[4][5] = "    |";
		c[4][6] = "    +";

		c[5][0] = "+---+";
		c[5][1] = "|    ";
		c[5][2] = "|    ";
		c[5][3] = "+---+";
		c[5][4] = "    |";
		c[5][5] = "    |";
		c[5][6] = "+---+";

		c[6][0] = "+---+";
		c[6][1] = "|    ";
		c[6][2] = "|    ";
		c[6][3] = "+---+";
		c[6][4] = "|   |";
		c[6][5] = "|   |";
		c[6][6] = "+---+";

		c[7][0] = "+---+";
		c[7][1] = "    |";
		c[7][2] = "    |";
		c[7][3] = "    +";
		c[7][4] = "    |";
		c[7][5] = "    |";
		c[7][6] = "    +";

		
		c[8][0] = "+---+";
		c[8][1] = "|   |";
		c[8][2] = "|   |";
		c[8][3] = "+---+";
		c[8][4] = "|   |";
		c[8][5] = "|   |";
		c[8][6] = "+---+";
		
		c[9][0] = "+---+";
		c[9][1] = "|   |";
		c[9][2] = "|   |";
		c[9][3] = "+---+";
		c[9][4] = "    |";
		c[9][5] = "    |";
		c[9][6] = "+---+";
		
		
		
		
		
		
		
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		while(true)
		{
			String s = bf.readLine();
			
			if(s.equals("end"))
			{
				System.out.println("end");
				break;
			}
			
			int[] a = new int[4];
			a[0] = Integer.parseInt(s.charAt(0) + "");
			a[1] = Integer.parseInt(s.charAt(1) + "");
			a[2] = Integer.parseInt(s.charAt(3) + "");
			a[3] = Integer.parseInt(s.charAt(4) + "");
			
			StringBuffer sb = new StringBuffer(29);
			for(int i = 0; i < 7; i++)
			{
			
				
				sb.append(c[a[0]][ i]);
				sb.append("  ");
				sb.append(c[a[1]][ i]);
				if((i == 2) || (i == 4))
				{
					sb.append("  o  ");					
				} else sb.append("     ");
				sb.append(c[a[2]][ i]);
				sb.append("  ");
				sb.append(c[a[3]][ i]);
				sb.append("\n");
			}
			System.out.println(sb + "\n");
			
		}
		
		
		
		
		
		
	}
	
	
	
	
	
	
}


