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 = raw_input()
s = raw_input()

pos = 0
ans = [[0] * (5 * len(s)) for i in xrange(5 * len(s))]

def print_me(c, cp, depth):
    global pos
    global ans
    if (cp == '[') & (c == ']'):
        pos += 3
    height = (max_depth - depth) * 2 + 1
    if (c == '['):
        ans[pos][depth] = 1
        ans[pos + 1][depth] = 2
        ans[pos][depth + height + 1] = 1
        ans[pos + 1][depth + height + 1] = 2
    else:
        ans[pos][depth] = 1
        ans[pos - 1][depth] = 2
        ans[pos][depth + height + 1] = 1
        ans[pos - 1][depth + height + 1] = 2

    for i in xrange(height):
        ans[pos][depth + i + 1] = 3
    pos += 1

depth = [0] * len(s)
N = 0
i = 0
deep = 0
max_depth = 0
for c in s:
    if c == '[':
        depth[i] = N
        N += 1
    if c == ']':
        N -= 1
        depth[i] = N
    if (N - 1 > max_depth):
        max_depth = N - 1
    i += 1

c = '#'
for i in xrange(len(s)):
    print_me(s[i], c, depth[i])
    c = s[i]

for j in xrange(max_depth * 2 + 3):
    s = ''
    for i in xrange(pos):
        if ans[i][j] == 0:
            s += ' '
        if ans[i][j] == 1:
            s += '+'
        if ans[i][j] == 2:
            s += '-'
        if ans[i][j] == 3:
            s += '|'
    print s