In this problem, your task is to use ASCII graphics to paint a cardiogram. 

A cardiogram is a polyline with the following corners:$(0 ; 0),(a_{1} ; a_{1}),(a_{1} + a_{2} ; a_{1} - a_{2}),(a_{1} + a_{2} + a_{3} ; a_{1} - a_{2} + a_{3}), \ldots,(\sum_{i = 1}^{n} a_{i} ; \sum_{i = 1}^{n}(- 1)^{i + 1} a_{i})$

That is, a cardiogram is fully defined by a sequence of positive integers a_1, a_2, ..., a_{n}.

Your task is to paint a cardiogram by given sequence a_{i}.


-----Input-----

The first line contains integer n (2 ≤ n ≤ 1000). The next line contains the sequence of integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 1000). It is guaranteed that the sum of all a_{i} doesn't exceed 1000.


-----Output-----

Print max |y_{i} - y_{j}| lines (where y_{k} is the y coordinate of the k-th point of the polyline), in each line print $\sum_{i = 1}^{n} a_{i}$ characters. Each character must equal either « / » (slash), « \ » (backslash), « » (space). The printed image must be the image of the given polyline. Please study the test samples for better understanding of how to print a cardiogram.

Note that in this problem the checker checks your answer taking spaces into consideration. Do not print any extra characters. Remember that the wrong answer to the first pretest doesn't give you a penalty.


-----Examples-----
Input
5
3 1 2 5 1

Output
      / \     
   / \ /   \    
  /       \   
 /         \  
          \ / 

Input
3
1 5 1

Output
 / \     
  \    
   \   
    \  
     \ /

Difficulty: interview

Starter code:

Solutions:
n = int(input())
a = [int(i) for i in input().split()]
miny = 0
maxy = 0
s = 0
for i in range(n):
    if i % 2 == 0:
        s += a[i]
    else:
        s -= a[i]
    maxy = max(s, maxy)
    miny = min(s, miny)
dif = maxy - miny
size = sum(a)
res = [[" "] * size for i in range(dif)]
cur = [maxy, 0]
for i in range(n):
    if i % 2 == 0:
        cur[0] -= 1
    else:
        cur[0] += 1
    for j in range(a[i]):
        if i % 2 == 0:
            res[cur[0]][cur[1]] = "/"
            cur[0] -= 1
        else:
            res[cur[0]][cur[1]] = "\\"
            cur[0] += 1
        cur[1] += 1

for i in res:
    print("".join(i))

import operator


n = int(input())
a = tuple(map(int, str.split(input())))

p = [(0, 0)]
for i, x in enumerate(a):

    p.append((p[-1][0] + x, p[-1][1] + (-1) ** i * x))

ymax = max(p, key=operator.itemgetter(1))[1]
ymin = min(p, key=operator.itemgetter(1))[1]

columns = []
for i in range(n):

    x1, y1 = p[i]
    x2, y2 = p[i + 1]
    while x1 != x2:

        if y1 < y2:

            columns.append(" " * (ymax - y1 - 1) + "/" + " " * (y1 - ymin))
            y1 += 1

        else:

            columns.append(" " * (ymax - y1) + "\\" + " " * (y1 - ymin - 1))
            y1 -= 1

        x1 += 1

print(str.join("\n", [str.join("", t) for t in zip(*columns)]))


n = int(input())
a = list(map(int, input().split()))
x = sum(a)
arr = [[-1,0,0]]
for i in range(n):
    
    if i % 2 == 0:
        arr.append([arr[-1][0] + 1, arr[-1][1], '/'])
        for k in range(a[i] - 1):
            arr.append([arr[-1][0] + 1, arr[-1][1] + 1, '/'])
    else:
        arr.append([arr[-1][0] + 1, arr[-1][1], '\\'])
        for k in range(a[i] - 1):
            arr.append([arr[-1][0] + 1, arr[-1][1] - 1, '\\'])
for i in range(len(arr)):
    arr[i][0], arr[i][1] = arr[i][1], -arr[i][0]
arr.pop(0)
arr.sort()
arr = arr[::-1]
for i in range(len(arr)):
    arr[i][1] = - arr[i][1]
print(' ' * arr[0][1], end = '')
print(arr[0][2], end = '')
for i in range(1, len(arr)):
    if arr[i][0] == arr[i - 1][0]:
        print(' ' * (arr[i][1] - arr[i - 1][1] - 1), end = '')
        print(arr[i][2], end = '')
    else:
        print(' ' * (x - arr[i - 1][1] - 1))
        print(' ' * arr[i][1], end = '')
        print(arr[i][2], end = '')        
print(' ' * (x - arr[-1][1] - 1), end = '')

import operator

n = int(input())
points = list(map(int, input().split()))

def praf(g):
    for i in g[1:]:
        print(''.join(i))

def calc(n):
    nonlocal points
    a = b = 0
    step = 1
    for i in range(n):
        a += points[i]
        b += points[i] * step
        step = -step
    return (a, b)

seq = [(0, 0)]
for i in range(len(points)):
    seq.append(calc(i+1))

seq = sorted(seq, key=lambda x: x[0])
seq = {i: seq[i] for i in range(len(seq))}
#print(seq)

for i in range(len(seq)):
    r = 0
    if i != len(seq)-1:
        if seq[i][1] > seq[i+1][1]:
            r = -1
        else:
            r = 1

    seq[i] = seq[i] + tuple([r])


seqy = sorted(list(seq.items()), key=lambda x: x[1][1], reverse=True)

pts = {x[0]: x[2] for x in list(seq.values())}

pts[seq[len(seq)-1][0]] = 1

#print('---seq---')
#print(seq)
#print('----seqy---')
#print(seqy)
#print('---pts---')
#print(pts)

graph = [[' '] * seq[len(seq)-1][0] for x in range(seqy[0][1][1]-seqy[-1][1][1]+1)]

y = seqy[0][1][1]


way = pts[0]
for i in range(len(graph[0])):
    if i in list(pts.keys()):
        if pts[i] != way:
            if way == 1:
                y+=1
            else:
                y-=1

        way = pts[i]


    graph[y][i] = '/' if way == 1 else '\\'
    y -= way
#    praf(graph)


#print('----------------graph-----------------------------------------------------------')
praf(graph)







#praf(graph)



n = int(input())
a = [int(c) for c in input().split()]

kardio = [[]]


# for i in range(len(a)):
#     x += a[i]
#     if i % 2 == 1:
#         y -= a[i]
#     else:
#         y += a[i]
#
#     kardio.append((x,y))
#
# print(kardio)


def add_to_kardio(index, symbol):
    # print('before_add',kardio,index,symbol)
    for i in range(len(kardio)):
        tmp = symbol if i == index else ' '
        kardio[i].append(tmp)
    # print('after_add',kardio)

def add_empty_top(length):
    # print('add_top',length,[' '] * length)
    kardio.insert(0, [' '] * length)


def add_empty_bottom(length):
    kardio.append([' '] * length)

current_x = 0
current_y = -1

for i in range(len(a)):
    if i % 2 == 0:
        current_y += 1
        for t in range(a[i]):
            # print('trying to up: ',current_y)
            current_y -= 1

            if current_y >= 0:
                add_to_kardio(current_y,'/')
            else:
                add_empty_top(current_x)
                current_y = 0
                add_to_kardio(current_y, '/')


            current_x +=1
            # print(kardio)
    else:
        current_y -= 1
        for t in range(a[i]):
            # print('trying to down: ',current_y)
            current_y += 1

            if current_y < len(kardio):
                add_to_kardio(current_y, '\\')
            else:
                add_empty_bottom(current_x)
                add_to_kardio(current_y, '\\')

            current_x +=1
            # print(kardio)

for i in range(len(kardio)):
    print(''.join(kardio[i]))

3

import sys
import math

n = int(sys.stdin.readline())
movement_array = [int(nbr) for nbr in sys.stdin.readline().split()]

relative_pos = [(0,1)]
currentPos = 0
direction = 1
for move in movement_array:
	currentPos += move * direction
	direction *= -1
	relative_pos.append((currentPos,direction))

objective_pos = []
#print(relative_pos)
minimum = min(relative_pos, key=lambda x: x[0])[0]
for n in range(0,len(relative_pos)):
	objective_pos.append((relative_pos[n][0] + (-minimum), relative_pos[n][1]))

width = 0
for n in range(0,len(objective_pos)-1):
	width += math.fabs(objective_pos[n+1][0]-objective_pos[n][0])
width = int(width)

height = max(objective_pos, key=lambda x: x[0])[0] + 1

matrix = [[" " for x in range(width)] for x in range(height-1)]

#print(objective_pos)
 
xpos = 0
for n in range(0,len(objective_pos)-1):
	direction = objective_pos[n][1]
	ypos = objective_pos[n][0]
	#print(ypos)
	targetpos = objective_pos[n+1][0]
	while math.fabs(ypos - targetpos) > 0:
		if direction == 1:
			matrix[ypos][xpos] = "/"
			ypos += 1
		else:
			matrix[ypos-1][xpos] = "\\"
			ypos -= 1
		xpos += 1

for row in reversed(matrix):
	print("".join(row))







n = int(input())
a = list(map(int, input().split()))
x = [0] * (n + 1)
y = [0] * (n + 1)
for i in range(1, n + 1):
  x[i] = x[i - 1] + a[i - 1]
  y[i] = y[i - 1]
  if i % 2 == 0:
    y[i] -= a[i - 1]
  else:
    y[i] += a[i - 1]
# print(x)
# print(y)
m = min(y)
if m < 0:
  for i in range(n + 1):
    y[i] -= m
# print(y)
w = max(x)
h = max(y)
# print(h, w)
d = [[" "] * w for i in range(h)]
for i in range(n):
  if y[i] < y[i + 1]:
    for j in range(a[i]):
#       print(y[i] + j, x[i] + j, "/")
      d[y[i] + j][x[i] + j] = "/"
  else:
    for j in range(a[i]):
#       print(y[i] - j - 1, x[i] + j, "\\")
      d[y[i] - j - 1][x[i] + j] = "\\"
print("\n".join("".join(d[i]) for i in reversed(range(h))))

n = int(input())
a = list(map(int, input().split()))
x = [0] * (n + 1)
y = [0] * (n + 1)
for i in range(1, n + 1):
  x[i] = x[i - 1] + a[i - 1]
  y[i] = y[i - 1]
  if i % 2 == 0:
    y[i] -= a[i - 1]
  else:
    y[i] += a[i - 1]
m = min(y)
if m < 0:
  for i in range(n + 1):
    y[i] -= m
w = max(x)
h = max(y)
d = [[" "] * w for i in range(h)]
for i in range(n):
  if y[i] < y[i + 1]:
    for j in range(a[i]):
      d[y[i] + j][x[i] + j] = "/"
  else:
    for j in range(a[i]):
      d[y[i] - j - 1][x[i] + j] = "\\"
print("\n".join("".join(d[i]) for i in reversed(range(h))))

n, a = int(input()), list(map(int, input().split()))
if n & 1: a.append(0)
x, t = 0, [[' '] * sum(a) for i in range(2001)]
y = u = v = 1000
for i in range(0, n, 2):
    for j in range(a[i]):
        t[y][x] = '/'
        x += 1
        y += 1
    v = max(v, y)
    for j in range(a[i + 1]):
        y -= 1
        t[y][x] = '\\'
        x += 1
    u = min(u, y)
for i in range(v - 1, u - 1, -1): print(''.join(t[i]))

n = int(input())
a_list = list(map(int, list(str(input()).split(" "))))

out = [' '*(sum(a_list))]*2000
cur,pref_size = 1000, 0
cur_max, cur_min = 1000,1000
for k in range(n):
    for i in range(a_list[k]):
        ind = pref_size + i
        if k % 2 == 0:
            out[cur] = out[cur][:ind] + '/' + out[cur][ind+1:]
            cur += 1
        else:
            out[cur] = out[cur][:ind] + '\\' + out[cur][ind+1:]
            cur -= 1

    if k % 2 == 1:
        cur += 1
        cur_min = min(cur_min, cur)
    else:
        cur -= 1
        cur_max = max(cur_max, cur)
        
    pref_size += a_list[k]

for i in range(cur_max,cur_min-1,-1):
    print(out[i])


n = int(input())
a = list(map(int, input().split()))
graph = [[' '] * 1000 for _ in range(2001)]
x, y = 0, 1000

for i in range(n):
    for j in range(a[i]):
        if i % 2:
            graph[y][x] = '\\'
            if j != a[i] - 1:
                y += 1
        else:
            graph[y][x] = '/'
            if j != a[i] - 1:
                y -= 1
        x += 1

for i in range(2000, -1, -1):
    graph[i] = ''.join(graph[i][:x])
    if not len(set(graph[i]) & set(['/', '\\'])):
        graph.pop(i)

print('\n'.join(graph))


n, a = int(input()), list(map(int, input().split()))
if n & 1: a.append(0)
x, t = 0, [[' '] * sum(a) for i in range(2001)]
y = u = v = 1000
for i in range(0, n, 2):
    for j in range(a[i]):
        t[y][x] = '/'
        x += 1
        y += 1
    v = max(v, y)
    for j in range(a[i + 1]):
        y -= 1
        t[y][x] = '\\'
        x += 1
    u = min(u, y)
for i in range(v - 1, u - 1, -1): print(''.join(t[i]))

n = input()
a = list(map(int,input().split()))
l = sum(a)
h = maxh = minh = 1000
table = [[" "]*l for i in range(2001)]
k = 0
sign = 1
for i in a:
    if sign == 1:
        for j in range(i):
            table[h+j][k+j] = "/"
        maxh = max(maxh,h+(i-1))
        h += i-1
    else:
        for j in range(i):
            table[h-j][k+j] = "\\"
        minh = min(minh,h-(i-1))
        h -= i-1
    k += i
    sign *= -1
for i in range(maxh,minh-1,-1):
    print (''.join(table[i]))

n = int(input())
a = list(map(int, input().split()))

Max = 1000
Min = 1000

sum = 0
for i in range(len(a)):
    sum += a[i]

myMap = [[" "] * 2020 for i in range(2020)]

x, y = 1000, 0
for i in range(n):
    if (i & 1) == 0:
        for j in range(a[i]):
            myMap[x][y] = "/"
            x -= 1
            y += 1
        x += 1
    else:
        for j in range(a[i]):
            myMap[x][y] = "\\"
            x += 1
            y += 1
        x -= 1
    Max = max(Max, x)
    Min = min(Min, x)


    
for i in range(Min, Max + 1):
    print("".join(myMap[i][:y]))


n = int(input())
a = list(map(int, input().split()))

Max = 1000
Min = 1000

sum = 0
for i in range(len(a)):
    sum += a[i]

myMap = [[" "] * 2020 for i in range(2020)]

x, y = 1000, 0
for i in range(n):
    if (i & 1) == 0:
        for j in range(a[i]):
            myMap[x][y] = "/"
            x -= 1
            y += 1
        x += 1
    else:
        for j in range(a[i]):
            myMap[x][y] = "\\"
            x += 1
            y += 1
        x -= 1
    Max = max(Max, x)
    Min = min(Min, x)


    
for i in range(Min, Max + 1):
    print("".join(myMap[i][:y]))


n, a = int(input()), list(map(int, input().split()))

if n & 1: a.append(0)

x, t = 0, [[' '] * sum(a) for i in range(2001)]

y = u = v = 1000

for i in range(0, n, 2):

    for j in range(a[i]):

        t[y][x] = '/'

        x += 1

        y += 1

    v = max(v, y)

    for j in range(a[i + 1]):

        y -= 1

        t[y][x] = '\\'

        x += 1

    u = min(u, y)

for i in range(v - 1, u - 1, -1): print(''.join(t[i]))



# Made By Mostafa_Khaled


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

n = mint()
y = 0
x = 0
a = []
t = 0
mx = dict()
my = 10**9
for i in mints():
	for j in range(i):
		if t == 0:
			a.append((x,y,'/'))
			mx[y] = max(mx.get(y, -1), x)
			my = min(my, y)
			y -= 1
		else:
			y += 1
			a.append((x,y,'\\'))
			mx[y] = max(mx.get(y, -1), x)
			my = min(my, y)
		x += 1
	t ^= 1
i = 0
b = []
while (my+i) in mx:
	b.append([' ']*(mx[my+i]+1))
	i += 1
for i in a:
	b[i[1]-my][i[0]] = i[2]
for i in b:
	print(*(i+[' ']*(x-len(i))),sep='')


N = int(2e3+3)
n = int(input())
a = list(map(int, input().split()))
maxi, mini = N//2, N//2
res = [[' '] * N for i in range(N)]
x, y = N//2, 0
for i in range(n):
    if i % 2 == 0:
        for j in range(a[i]):
            res[x][y] = '/'
            x -= 1
            y += 1
        x += 1
    else:
        for j in range(a[i]):
            res[x][y] = '\\'
            x += 1
            y += 1
        x -= 1
    maxi = max(maxi, x)
    mini = min(mini, x)
for i in range(mini, maxi+1):
    print(''.join(res[i][:y]))


n = int(input())
lis = list(map(int,input().split()))
ma=r=0
mi=a=0
for i in range(n):
    if i%2==0:
        a+=lis[i]
    else:
        a-=lis[i]
    ma=max(ma,a)
    mi=min(mi,a)
    r+=lis[i]
mat=[[' ']*(r) for i in range(ma+abs(mi)+2)]    
ro=ma
col=0
for i in range(n):
    if i%2==0:
        ro-=1
        for k in range(lis[i]):
            mat[ro][col]='/'
            ro-=1
            col+=1
    else:
        ro+=1
        for k in range(lis[i]):
            mat[ro][col]='\\'
            ro+=1
            col+=1
for i in mat[:]:
    print(*i,sep='')            
            




import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

n = r()
a = rl()
w = sum(a)
h = -math.inf
d = math.inf
ptr = 0
for i,j in enumerate(a):
    ptr += (j-1 if i%2==0 else 1-j)
    h = max(h,ptr)
    d = min(d,ptr)

b = [[' ']*w for i in range(h+abs(d)+1)]
j=0
incr=True
for i in range(n):
    H=a[i]
    while H!=0:
        if incr:
            b[h][j]='/'
            j+=1
            h-=1
        else:
            b[h][j]='\\'
            j+=1
            h+=1
        H-=1
    if incr:
        h+=1
    else:
        h-=1
    incr = not incr
for i in b:
    print(*i,sep='')