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 PYTHON3):

Solution:
#!/usr/local/bin/python3.6

class t4:

	def run(self,tr,az):
		#print(az);
		if self._Q >= len(tr):
			return az;
		if tr[self._Q]=="[":
			self._Y+=1;
			az[self._Q]=-self._Y;
			self._Q+=1;
		else:
			az[self._Q]=self._Y;
			self._Y-=1;
			self._Q+=1;
		return self.run(tr,az);

	def trans_func(self,data):
		tr_matrix = []
		for row in data:
			tr_matrix.append(row[::-1])
		return tr_matrix

	def qu(self,az,w):
		if az[w]==0:
			return;
		q=w 
		c=int(len(az)/2)
		if len(az)%2!=0:
			c+=1;

		self.bz[c][q]='.'
		t=self._M-abs(az[w])
		for i in range(0,t):
			self.bz[c-i][q]='|'
			self.bz[c+i][q]='|'
		self.bz[c-t][q]='+'
		self.bz[c+t][q]='+'
		if az[w]>0:
			i=-1
		else:
			i=1;
		if self.bz[c-t][q+i]!=' ':
			self._Q+=1;
			q+=1;
		self.bz[c-t][q+i]='-'
		self.bz[c+t][q+i]='-'

	def draw(self,az):
		i=1;
		while i < len(az):
			if abs(az[i])==abs(az[i-1]) and az[i]!=0 and az[i-1] < 0:
				az=az[:i]+[0,0,0]+az[i:]
				i+=1;
			i+=1;

		#print(az);
		
		self._M=max(az)+1;
		self.bz=[];
		WW=max(len(az)+1,self._M*2+1)
		for i in range(0,WW):
			cz=[];
			for j in range(0,WW):
				cz.append(' ');
			self.bz.append(cz);

		self._Q=0;
		for i in range(0,len(az)):
			self.qu(az,i);


	def print_norm(self,az):
		az=self.trans_func(az)
		for i in range(0,len(az)):
			st=""
			for j in range(0,len(az[i])):
				st+=az[i][-j];
			if not st.isspace():
				print(st.lstrip(' ').rstrip(' '));


	def __init__(self):
		self._Q=0;
		self._Y=0;
		x=int(input());
		y=input();
		#x=len(y);
		tr=[];
		tr.extend(y);
		az=[];
		for i in range(0,x):
			az.append(0);
		az = self.run(tr,az)
		self.draw(az);

		self.print_norm(self.bz);

t4();