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:
lmap = lambda func, x: list(map(func, x))




_, scobes = input(), input()#'', '[[[][][][][][][][]][]][]'
scobes = scobes.replace('[]', '[   ]')

def empty_list(s):
	return [0] * s

def two_dim_array(size):
	return [empty_list(size[0]) for i in range(size[1])]

def process_scobes(scobes):

	depthes = []
	depth = 0
	for i, scobe in enumerate(scobes):
		if scobe == '[':
			depth+=1
		depthes.append(depth)

		if scobe == ']':
			depth-=1

	
	max_depth = max(depthes)
	depthes = lmap(lambda val: 2*(max_depth - val+1)+1, depthes)
	return depthes

def set_on_interval(from_, to_):
	pass

def draw_scobes_into_array(scobes, heights):
	picture = two_dim_array([len(scobes), max(heights)])
	middle = (max(heights) + 1)//2 

	for i, scobe in enumerate(scobes):
		h = heights[i] //2 - 1
		if scobe!=' ':
			for height in range(middle-h - 1, middle+h):
				picture[height][i] = 1

			picture[middle - h - 2][i] = 2
			picture[middle + h][i] = 2
			offset = 1 if scobe == '[' else -1
			picture[middle - h - 2][i + offset] = 3
			picture[middle + h][i + offset] = 3

	return picture



heights = process_scobes(scobes)

picture = draw_scobes_into_array(scobes, heights)


draw_line = lambda line: ''.join(lmap(str, line)).replace('0', ' ').replace('1', '|').replace('2', '+').replace('3', '-')
print('\n'.join(lmap(draw_line, picture)))

#Here was me!