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:
import sys


def find_max(s):
    r = 0
    cur = 0
    for i in s:
        if i == 0:
            cur += 1
        else:
            cur -= 1
        if cur > r:
            r = cur
    return r


def render_space(img, h):
    for i in xrange(0, h):
        img[i].append(" ")


def render_line(img, l, r, h, mflag):
    for i in xrange(0, h):
        c = " "
        if i == l or i == r:
            c = "+"
        elif l < i < r:
            c = "|"
        if mflag:
            img[i][-1] = c if img[i][-1] == " " else img[i][-1]
        else:
            img[i].append(c)


def render_minus(img, l, r, h, mflag):
    for i in xrange(0, h):
        c = " "
        if i == l or i == r:
            c = "-"
        if mflag:
            img[i][-1] = c if img[i][-1] == " " else img[i][-1]
        else:
            img[i].append(c)


def render_open(img, l, r, h, mflag):
    render_line(img, l, r, h, mflag) 
    render_minus(img, l, r, h, False)


def render_close(img, l, r, h, mflag):
    render_minus(img, l, r, h, mflag)
    render_line(img, l, r, h, False) 


def render(s):
    h = 2 * find_max(s) + 1
    img = [[] for _ in xrange(h)]

    l = 0
    r = h - 1

    last = -1, -1
    for i in s:
        if i == 0:
            mflag = (last == (0, l - 1))
            render_open(img, l, r, h, mflag)
            last = 0, l
            l = l + 1
            r = r - 1
        else:
            l = l - 1
            r = r + 1
            if last == (0, l):
                render_space(img, h)
            mflag = (last == (1, l + 1))
            render_close(img, l, r, h, mflag)
            last = 1, l

    return img


def main():
    n = int(sys.stdin.readline().strip())
    s = map(lambda x: 0 if x == "[" else 1, sys.stdin.readline().strip())
    img = render(s)
    for i in img:
        print "".join(i)


if __name__ == "__main__":
    main()