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.StringTokenizer;

public class D {
	public static BufferedReader reader;
	public static PrintWriter writer;
	public static StringTokenizer tokenizer;
	
	public static String nextToken() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
			}
		}
		return tokenizer.nextToken();
	}

	public static int nextInt() {
		return Integer.parseInt(nextToken());
	}

	public static long nextLong() {
		return Long.parseLong(nextToken());
	}

	public static int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}
	
	public static void solve() {
		int n = nextInt();
		String psp = nextToken();
		int[] pspd = new int[n];
		int depth = 0;
		int maxDepth = 0;
		boolean isUp = false;
		int upDownAmount = 0;
		for (int i = 0; i < n; i++) {
			if (psp.charAt(i) == '[') {
				isUp = true;
				depth++;
				pspd[i] = depth;
			} else {
				if (isUp) {
					upDownAmount++;
				}
				isUp = false;
				pspd[i] = -depth;
				depth--;
			}
			maxDepth = Math.max(maxDepth, depth);
		}
		int w = n + upDownAmount * 3;
		int h = 2 * maxDepth + 1;
		char[][] mat = new char[w][h];
		for (int i = 0; i < mat.length; i++) {
			for (int j = 0; j < mat[i].length; j++) {
				mat[i][j] = ' ';
			}
		}
		
		isUp = false;
		int sign = 0;
		int x = 0, y = 0;
		for (int i = 0; i < pspd.length; i++) {
			int skoba = pspd[i];
			if (skoba > 0) {
				sign = 1;
				isUp = true;
			} else {
				sign = -1;
				if (isUp) {
					x += 3;
				}
				isUp = false;
			}
			y = Math.abs(skoba) - 1;
			mat[x][y] = '+';
			mat[x + sign][y] = '-';
			for (int j = y + 1; j < h - y - 1; j++) {
				mat[x][j] = '|';
			}
			mat[x + sign][h - y - 1] = '-';
			mat[x][h - y - 1] = '+';
			x++;
		}
		
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				writer.print(mat[j][i]);
			}
			writer.println();
		}
	}

	public static void main(String[] args) throws IOException {
		reader = new BufferedReader(new InputStreamReader(System.in));
		writer = new PrintWriter(System.out);
		solve();
		reader.close();
		writer.close();
	}
}