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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D implements Runnable {

    void draw(char[][] pic, int l, int z, int h, int open) {
        for (int i = z - h + 1; i <= z + h - 1; i++) pic[i][l] = '|';
        pic[z - h][l] = pic[z + h][l] = '+';
        pic[z - h][l + open] = pic[z + h][l + open] = '-';
    }

    void solve() throws IOException {
        int n = nextInt();
        String s = nextToken();
        int maxB = 0;
        int b = 0;
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '[') b++; else b--;
            maxB = Math.max(b, maxB);
        }
        int h = maxB;
        char[][] pic = new char[maxB * 2 + 1][3 * n];
        for (char[] c : pic) Arrays.fill(c, ' ');
        int z = maxB;
        int l = -1;
        char prev = ']';
        for (int i = 0; i < n; i++) {
            char c = s.charAt(i);
            if (c == ']' && prev == '[') l += 4; else l++;
            if (c == ']') h++;
            draw(pic, l, z, h, c == '[' ? 1 : -1);
            if (c == '[') h--;
            prev = c;
        }
        for (int i = 0; i < maxB * 2 + 1; i++) {
            out.println(String.valueOf(pic[i], 0, l + 1));
        }
    }

    public static void main(String[] args) {
	    new Thread(null, new D(), "name", 1 << 27).start();
    }

    @Override
    public void run() {
        try {
            solve();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        } finally {
            out.close();
        }
    }

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);
    StringTokenizer st;

    String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
}