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:
def draw(ind, type, size):
    global ans, mid
    ans[mid][ind] = '|'
    for i in range(size // 2):
        ans[mid + i][ind] = '|'
        ans[mid - i][ind] = '|'
    ans[mid + size // 2][ind] = '+'
    ans[mid - size // 2][ind] = '+'
    if type == "left":
        ans[mid + size // 2][ind - 1] = '-'
        ans[mid - size // 2][ind - 1] = '-'
    else:
        ans[mid + size // 2][ind + 1] = '-'
        ans[mid - size // 2][ind + 1] = '-'


n = int(input())
s = input()
mx = 0
cs = 0
for i in range(n):
    if s[i] == "[":
        cs += 1
    else:
        cs -= 1
    mx = max(mx, cs)
mx -= 1
a = [mx]
for i in range(1, n):
    if (s[i] == "[" and s[i - 1] == "]") or (s[i - 1] == "[" and s[i] == "]"):
        a.append(a[-1])
    elif s[i] == "[":
        a.append(a[-1] - 1)
    else:
        a.append(a[-1] + 1)
ans = [[' ' for i in range(n * 3)] for j in range(3 + mx * 2)]
mid = mx + 1
draw(0, "right", mx * 2 + 3)
li = 0
for i in range(1, n):
    if s[i] == "[" and s[i - 1] == "]":
        li += 1
        draw(li, "right", a[i] * 2 + 3)
    elif s[i - 1] == "[" and s[i] == "]":
        li += 4
        draw(li, "left", a[i] * 2 + 3)
    elif s[i] == "[":
        li += 1
        draw(li, "right", a[i] * 2 + 3)
    else:
        li += 1
        draw(li, "left", a[i] * 2 + 3)
for i in ans:
    for j in range(li + 1):
        print(i[j], end="")
    print()