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

Solution:
n = int(raw_input())

s = raw_input().strip()
a = [0] * (len(s))

cnt = 0
max_cnt = 0
for i in xrange(len(s)):
    if s[i] == '[':
        cnt += 1
    a[i] = cnt
    max_cnt = max(cnt, max_cnt)
    if s[i] == ']':
        cnt -= 1
        
a = [3 + 2 * (max_cnt - ai) for ai in a]


height = 3 + 2 * (max_cnt - 1)

num_closed_groups = 0
for i in xrange(len(s) - 1):
    if s[i] == '[' and s[i + 1] == ']':
        num_closed_groups += 1
        
num_cols = len(s) + num_closed_groups * 3
num_rows = height

ans = [[' '] * num_cols for _ in xrange(num_rows)]

add_to_index = 0
for index, (br, h) in enumerate(zip(s, a)):
    if s[index] == ']' and s[index - 1] == '[':
        add_to_index += 3
    index = index + add_to_index
    diff = (height - h) / 2
    
    ans[diff][index] = '+'
    if br == '[' and index + 1 < num_cols:
        ans[diff][index + 1] = '-'
    elif br == ']' and index - 1 >= 0:
        ans[diff][index - 1] = '-'
        

    ans[height - diff - 1][index] = '+'
    if br == '[' and index + 1 < num_cols:
        ans[height - diff - 1][index + 1] = '-'
    elif br == ']' and index - 1 >= 0:
        ans[height - diff - 1][index - 1] = '-'
    
    for y in xrange(diff + 1, height - diff - 1):
        ans[y][index] = '|'

for i in xrange(num_rows):
    print ''.join(ans[i])