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:
class Brace():
    def __init__(self, is_open, cur_lvl, max_lvl):
        self.cur_height = 2 * cur_lvl + 1
        self.max_height = 2 * max_lvl + 1
        self.diff = self.max_height - self.cur_height
        self.dct = {i: '  ' for i in range(self.max_height)}
        self.dct[self.diff/2] = self.dct[self.max_height - self.diff/2 - 1] = '+-' if is_open else '-+'
        for x in range(self.diff/2 + 1, self.max_height - self.diff/2 -1):
            self.dct[x] = '| ' if is_open else ' |'
        self.is_open = is_open

    def __str__(self):
        return '\n'.join([self.dct[x] for x in range(self.max_height)])

    def __add__(self, other):
        if self.is_open and not other.is_open:  # []
            for i in range(self.max_height):
                self.dct[i] += ' ' + other.dct[i]
        elif self.is_open and other.is_open:  # [[
            for i in range(self.max_height):
                if self.dct[i][-1] == '-':
                    self.dct[i] += ' '
                else:
                    self.dct[i] = self.dct[i][:-1] + other.dct[i]
        elif not self.is_open and not other.is_open:  # ]]
            for i in range(self.max_height):
                if other.dct[i][-1] == '+':
                    self.dct[i] = self.dct[i][:-1] + other.dct[i]
                else:
                    self.dct[i] = self.dct[i] + other.dct[i][1:]
        else:  # ][
            for i in range(self.max_height):
                self.dct[i] += other.dct[i]
        self.is_open = other.is_open
        return self


def sum_brace():
    _ = raw_input()
    inp = raw_input()
    max_lvl = 1
    cur_lvl = 0
    for brace in inp:
        if brace == '[':
            cur_lvl += 1
            if cur_lvl > max_lvl:
                max_lvl = cur_lvl
        else:
            cur_lvl -= 1

    cur_lvl = max_lvl
    sb = None
    for brace in inp:
        is_open = brace == '['
        if not is_open:
            cur_lvl += 1
        if not sb:
            sb = Brace(is_open, cur_lvl, max_lvl)
        else:
            sb += Brace(is_open, cur_lvl, max_lvl)
        if is_open:
            cur_lvl -= 1
    return sb

print(sum_brace())