import java.util.Scanner;
public class Examen01 {
  
  public static void main(String[] args) { 
    Scanner teclado = new Scanner (System.in);
    System.out.println("LED number display");
    
    while (true){
      System.out.print("\nNumero a mostrar [0=Salir]: ");
      teclado.skip("[\n\r\t ]*");
      String numero = teclado.nextLine();
      if (numero.equals("0")){
        return;
      }
      else{
        System.out.print("Factor de aumento (x): ");
        int factor = teclado.nextInt();
        for(int i=0; i<numero.length(); ++i){
          if (numero.charAt(i) == '0'){
            for ( int fila = 1; fila <= (5*factor); ++fila){
              for ( int columna = 1; columna <= (3*factor); ++columna){
                if (fila <=factor || fila >(4*factor)){
                  System.out.print("#");
                }
                else if (columna<=factor || columna>(2*factor)){
                  System.out.print("#");
                }else
                  System.out.print(" ");
              }
              System.out.println();
            }
          }
          else if (numero.charAt(i) == '1'){
            for (int fila = 1; fila <=(5*factor); ++fila){
              for ( int columna = 1; columna <= factor; ++columna ){
                System.out.print("#");
              }
              System.out.println();
            }
          }
          else if (numero.charAt(i) == '2'){
            for ( int fila = 1; fila <= (5*factor); ++fila ){
              for ( int columna = 1; columna <= (3*factor); ++columna ){
                if ((fila <=factor) || (fila>(2*factor) && fila<=(3*factor)) || (fila >(4*factor))){
                  System.out.print("#");
                }
                else if(fila>factor && fila<=2*factor){
                  if (columna >(2*factor)){
                    System.out.print("#");
                  }else
                    System.out.print (" ");
                }else if (fila>3*factor && fila<=4*factor){
                  if(columna<=factor){
                    System.out.print("#");
                  }else
                    System.out.print (" ");
                }}
              System.out.println();
            }
          }
          System.out.println();
        }
      }  
    }
  }
}

