import java.util.Scanner;

public class IParcial_B05060
{
  public static void main(String args[])
  {
    Scanner teclado = new Scanner(System.in);
    System.out.println("LED number display");
    boolean seguir=true;
    int factor =1;
    
    while(seguir==true){
      System.out.println("Numero a mostrar [0=Salir]: ");
      teclado.skip("[\n\r\t]*");
      String numero= teclado.nextLine();
      
      if (numero.equals("0"))
        return;
      
      System.out.println("Factor de aumento: ");
      factor = teclado.nextInt();
      
      for(int a=0; a<numero.length();++a){
        /*if(numero.charAt(a)!='0'&&numero.charAt(a)!='2'&&numero.charAt(a)=='1'){
             seguir=false;*/
        if(numero.charAt(a)=='1'){
          for(int j=1;j<=(5*factor);++j){
            for(int i=1;i<=(1*factor);++i)
              System.out.print("#");
            System.out.println();}
          System.out.println("\n");
        }
        if(numero.charAt(a)=='0'){
          for(int k=1;k<=(5*factor);++k){
            for(int m=1;m<=(3*factor);++m){
              if(k<=1*factor||k>=(5*factor-factor+1))
                System.out.print("#");
              else if ((k>1*factor||k<(5*factor-factor))&&(m<=1*factor||(m>=3*factor-factor+1)))
                System.out.print("#");
              else if ((k>1*factor||k<(5*factor-factor)&&(m>1*factor||m<3*factor-factor+1)))
                System.out.print(" ");}
            System.out.println();}
          System.out.println("\n");
        }
        if(numero.charAt(a)=='2'){
          for(int x=1;x<=(5*factor);++x){
            for(int y=1;y<=(3*factor);++y){
              if(x<=1*factor||x>=(5*factor-factor+1))
                System.out.print("#");
              else if(x>1*factor&&x<=1*factor+factor&&y<=3*factor-factor)
                System.out.print(" ");
              else if(x>1*factor&&x<=1*factor+factor&&y>3*factor-factor)
                System.out.print("#");
              else if(x>1*factor+factor&&x<=1*factor+factor+factor)
                System.out.print("#");
              else if((x>1*factor*3&&x<=1*factor*4)&&(y<=1*factor))
                System.out.print("#");
              else if(x>=5*factor-factor+1)
                System.out.print("#");}
            System.out.println();}
          System.out.println("\n");
        }
        seguir=true;
        
      }
      
      
    }
    
    
    
  }
}
