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:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 11 23:20:54 2017

@author: Alexandr
"""

n = int(input())
brackets = input()
max_deep = 0
deep = [0] * n
d = 0
for i in range(n):
    if brackets[i] == '[':
        d += 1
        deep[i] = d
    else:
        deep[i] = d
        d -= 1

max_deep = max(deep)

ans = []
height = max_deep * 2 + 1

for i in range(n):
    x = (max_deep - deep[i]) * 2 + 1
    y = (height - x - 2) // 2    
    s = '+' + '|'*x + '+'
    if (
        i != 0 
        and brackets[i] == ']' 
        and brackets[i - 1] == '['
    ):
        ans.append(y * ' ' + '-' + x * ' ' + '-' + y * ' ')
        ans.append(' ' * height)            
        ans.append(y * ' ' + '-' + x * ' ' + '-' + y * ' ')
    if (
        i != 0 and i != n - 1
        and deep[i] != 1 
        and (deep[i] > deep[i - 1] or deep[i] > deep[i + 1])
    ):
        s = (y - 1) * ' ' + '-' + s + '-' + (y - 1) * ' '
        
    else:
        s = y * ' ' + s + y * ' '
    ans.append(s)

for i in zip(*ans):
    print(''.join(i))