Problem: A sequence of square brackets is regular if by inserting symbols "+" and "1" into it, you can get a regular mathematical expression from it. For example, sequences "[[]][]", "[]" and "[[][[]]]" — are regular, at the same time "][", "[[]" and "[[]]][" — are irregular. 

Draw the given sequence using a minimalistic pseudographics in the strip of the lowest possible height — use symbols '+', '-' and '|'. For example, the sequence "[[][]][]" should be represented as: 
    
    
      
    +-        -++- -+      
    |+- -++- -+||   |  
    ||   ||   |||   |  
    |+- -++- -+||   |  
    +-        -++- -+  
    

Each bracket should be represented with the hepl of one or more symbols '|' (the vertical part) and symbols '+' and '-' as on the example which is given above.

Brackets should be drawn without spaces one by one, only dividing pairs of consecutive pairwise brackets with a single-space bar (so that the two brackets do not visually merge into one symbol). The image should have the minimum possible height. 

The enclosed bracket is always smaller than the surrounding bracket, but each bracket separately strives to maximize the height of the image. So the pair of final brackets in the example above occupies the entire height of the image.

Study carefully the examples below, they adequately explain the condition of the problem. Pay attention that in this problem the answer (the image) is unique. 

Input

The first line contains an even integer n (2 ≤ n ≤ 100) — the length of the sequence of brackets.

The second line contains the sequence of brackets — these are n symbols "[" and "]". It is guaranteed that the given sequence of brackets is regular. 

Output

Print the drawn bracket sequence in the format which is given in the condition. Don't print extra (unnecessary) spaces. 

Examples

Input

8
[[][]][]


Output

+-        -++- -+
|+- -++- -+||   |
||   ||   |||   |
|+- -++- -+||   |
+-        -++- -+


Input

6
[[[]]]


Output

+-     -+
|+-   -+|
||+- -+||
|||   |||
||+- -+||
|+-   -+|
+-     -+


Input

6
[[][]]


Output

+-        -+
|+- -++- -+|
||   ||   ||
|+- -++- -+|
+-        -+


Input

2
[]


Output

+- -+
|   |
+- -+


Input

4
[][]


Output

+- -++- -+
|   ||   |
+- -++- -+

Solution (in JAVA):

Solution:
import java.util.ArrayList;
import java.util.Scanner;

public class taskD {

    static int n;
    static String symbols;

    static int deep;
    static ArrayList<Integer> map;
    static char[][] picture;
    static int wight, height;

    public static void main(String[] args) {
        inputting();
        analyze();
        drawing();
        outputting();
    }

    private static void drawing(){
        picture = new char[height][wight];
        for (int i=0;i<height;i++){
            for (int j=0;j<wight;j++){
                picture[i][j]=' ';
            }
        }
        int x;
        for (int i=0;i<wight;i++){
//            рисуем грани
            x=map.get(i);
            if(x>0){
                picture[x-1][i] = '+';
                picture[x-1][i+1] = '-';
                picture[height-x][i] = '+';
                picture[height-x][i+1] = '-';
            }else if(x<0){
                x=Math.abs(x);
                picture[x-1][i] = '+';
                picture[x-1][i-1] = '-';
                picture[height-x][i] = '+';
                picture[height-x][i-1] = '-';
            }else {
                continue;
            }
            for (int j=x;j<height-x;j++){
//                рисуем стенки
                picture[j][i] = '|';
            }
        }
    }

    private static void analyze(){
        int x=0;
        map = new ArrayList<>();
//        расчет максимальной глубины и составление размерной карты
        for(char c:symbols.toCharArray()){
            if(c=='['){
               x++;
               map.add(x);
            }else {
                map.add(-x);
                x--;
            }
            deep = Math.max(deep, x);
        }
//        добавление пробелов
        for(int i=0;i<n-1;i++){
            if((map.get(i)==(-map.get(i+1)))&&(map.get(i)>map.get(i+1))){
                for (int j=0;j<3;j++){
                    map.add(i+1+j,0);
                    n++;
                }
                i+=3;
            }
        }
//        расчет высоты и ширины изображения
        height = 3+(2*(deep-1));
        wight = map.size();
    }

    private static void outputting(){
        for (int i=0;i<height;i++){
            for (int j=0;j<wight;j++){
                System.out.print(picture[i][j]);
            }
            if(i!=height-1){
                System.out.println();
            }
        }
    }

    private static void inputting(){
        Scanner input = new Scanner(System.in);
        n = input.nextInt();
        symbols = input.next();
    }
}