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

public class dd {
	public static BufferedReader in = new BufferedReader( new InputStreamReader(System.in));

	public static String line =  "+---+";
	public static String rightpl="    +";
	public static String rightp ="    |";
	public static String twop   ="|   |";
	public static String twopl  ="+   +";
	public static String leftp  ="|    ";

	public static String [][] nums =  { {line,    twop,   twop,   twopl,   twop,   twop,   line},    //0
				     {rightpl, rightp, rightp, rightpl, rightp, rightp, rightpl}, //1
                                     {line,    rightp, rightp, line,    leftp,  leftp,  line},    //2
                                     {line,    rightp, rightp, line,    rightp, rightp, line},    //3
				     {twopl,   twop,   twop,   line,    rightp, rightp, rightpl}, //4
                                     {line,    leftp,  leftp,  line,    rightp, rightp, line},    //5
				     {line,    leftp,  leftp,  line,    twop,   twop,   line},    //6
				     {line,    rightp, rightp, rightpl, rightp, rightp, rightpl}, //7
				     {line,    twop,   twop,   line,    twop,   twop,   line},    //8
				     {line,    twop,   twop,   line,    rightp, rightp, rightpl}};//9
	                              

	public static void main(String [] args) throws Exception {
		while(true){
			String line = in.readLine();
			if(line.equals("end")) break;
			
			int h1, h2, m1, m2;
			h1 = Character.digit(line.charAt(0),10);
			h2 = Character.digit(line.charAt(1),10);
			m1 = Character.digit(line.charAt(3),10);
			m2 = Character.digit(line.charAt(4),10);
			
			for(int j=0; j<7; j++){
				System.out.print(nums[h1][j] + "  ");
				System.out.print(nums[h2][j] + "  ");
				if(j==2||j==4)System.out.print("o  ");
				else          System.out.print("   ");
				System.out.print(nums[m1][j] + "  ");
				System.out.println(nums[m2][j]);
			}
			System.out.println();
			System.out.println();
		}
		System.out.println("end");
	}
}
