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:
var l1 = readline().split(' ');
var l2 = readline().split(' ');
var n = l1[0];
var str = l2[0];
var ans = [];
for(var i=0; i<n*3;i++){
	ans[i]=[];
}
// var ans=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
var x=-1;
var y=-1;
for(var i=0; i<ans.length; i++){
	for(var j=0; j<ans.length; j++){
		ans[i][j]=" ";
	}
}
var maxY=0;
var maxX=0;
var maxI=0;
var mmaxX=0;
var mmaxY=0;
for(var i = 0; i<str.length;i++){
	if(str[i]=="["){
		x++;y++;
		ans[y][x]="+";ans[y][x+1]="-";
		if(maxY<y){
			maxY=y;
			maxX=x;
			maxI=i;
		}
	}else{
		if(str[i-1]!="["){
			x-=3;
		}
		ans[y][x+3]="-";ans[y][x+4]="+";
		x+=4;y-=1;
		if(x>mmaxX){
			mmaxX=x;
		}
	}
}
x=-1;
y=maxY*2+3;
for(var i = 0; i<str.length;i++){
	if(str[i]=="["){
		x++;y--;
		ans[y][x]="+";ans[y][x+1]="-";
		if(maxY<y){
			maxY=y;
			maxX=x;
			maxI=i;
		}
		if(y>mmaxY){
			mmaxY=y;
		}
	}else{
		if(str[i-1]!="["){
			x-=3;
		}
		ans[y][x+3]="-";ans[y][x+4]="+";
		x+=4;y+=1;
	}
}
for(var i = 0; i<ans.length;i++){
	for(var j = 0; j<ans.length;j++){
		if(ans[j][i]=="+"){
			for(var k=j+1; k<maxY-j;k++){
				ans[k][i]="|";
			}
		}
	}
}
var ans2="";
for(var i=0; i<mmaxY+1; i++){
	for(var j=0; j<mmaxX+1; j++){
		ans2+=ans[i][j];
	}
	ans2+='\n';
}
print(ans2);