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:
#Быдлокод
#Bydłokod

#Kaitei - zaijou wo tsukitsukete
#Suitei - kantei no kekka zantei
#Zentei - yuuzai tonikaku yuuzai
#Shirokuro hakkiri tsuke DANZAI!

def maxvlozh(stroka):
    stack = 0
    maxvl = 0;
    for i in range(len(stroka)):
        if stroka[i] == "[":
            stack += 1
        else:
            stack -= 1
        if maxvl < stack:
            maxvl = stack
    return maxvl

def kol_vlozh(stroka, i):
    stack = 0
    kol = -1
    for i in range(i, len(s)):
        if stroka[i] == "[":
            stack += 1
            kol += 1
        else:
            stack -= 1
        if stack == 0:
            break

    return kol

def kol_bezvlozh(stroka, i):
    p = 0
    stack = 0
    kol = 0;
    for i in range(i, len(s)):
        if stroka[i] == "[":
            stack += 1
            t = 1
        else:
            stack -= 1
            t = -1
        if p == 0:
            p = t
        if p > 0 and t < 0:
            kol += 1
        p = t
        if stack == 0:
            break
    return kol

def mass_vlozh(stroka, maxur):
    mass = []
    stack = 0
    p = 0
    for i in range(len(stroka)):
        if stroka[i] == "[":
            stack += 1
            mass.append(maxur - stack+1)
        else:
            stack -= 1
            mass.append(maxur - (stack))
    return mass

#всё вышеперечисленное можно в принципе отправить под пресс:
#maxur, mas_vlozh, mas_bezvlozh, mas_ur_visot = komress(s)       
        
input()
s = input()
#s = "[[[]][][[][]]][]"
maxur = maxvlozh(s)
mass = mass_vlozh(s, maxur)
stack_ris = []
stack_ur = maxur

for i in range(2*maxur + 1):
    ris = ""
    p = 0
    for j in range(len(mass)):
        if mass[j] == stack_ur:
            p = 1
            if s[j] == "[":
                ris += "+-"
                kol_vl = kol_vlozh(s, j)
                kol_bv = kol_bezvlozh(s, j)
                #print(kol_vl)
                #print(kol_bv)
                shir = kol_vl*2 +kol_bv*3 - 2
                #print(shir)
                ris += " "*shir
            elif s[j] == "]":
                ris += "-+"
        elif mass[j] > stack_ur:
            ris += "|"
            kol_vl = kol_vlozh(s, j)
            if s[j] == "[" and kol_vl == 0:
                ris += " "*3 
    stack_ris.append(ris)
    stack_ur -= 1
    if(stack_ur == -1):
        for j in range(len(stack_ris)):
            print(stack_ris[len(stack_ris)-j-1])
        break
    else:
        print(ris)