# Baekjoon-2290-LCD Test

s,n = map(int, input().split())

num_dict = {k: [[' '] * (s+2) for _ in range(2*s+3)] for k in range(10)}

def make_nums(arr, idxs):
for idx in idxs:
for i in range(s):
if idx==1:
arr[0][i+1] = '-'
if idx==2:
arr[i+1][0] = '|'
if idx==3:
arr[s+1][i+1] = '-'
if idx==4:
arr[i+1][-1] = '|'
if idx==5:
arr[s+1+i+1][0] = '|'
if idx==6:
arr[2*s+2][i+1] = '-'
if idx==7:
arr[s+1+i+1][-1] = '|'

return arr

num_dict[0] = make_nums(num_dict[0],[1,2,5,6,7,4])
num_dict[1] = make_nums(num_dict[1], [4,7])
num_dict[2] = make_nums(num_dict[2],[1,4,3,5,6])
num_dict[3] = make_nums(num_dict[3],[1,4,3,7,6])
num_dict[4] = make_nums(num_dict[4],[2,3,4,7])
num_dict[5] = make_nums(num_dict[5],[1,2,3,7,6])
num_dict[6] = make_nums(num_dict[6],[1,2,3,5,6,7])
num_dict[7] = make_nums(num_dict[7],[1,4,7])
num_dict[8] = make_nums(num_dict[8],[1,2,3,4,5,6,7])
num_dict[9] = make_nums(num_dict[9],[1,2,3,4,6,7])

n = "%d"%n
result = [[] for _ in range(2*s+3)]
for i in range(2*s+3):
for j,c in enumerate(n):
result[i] += num_dict[int(c)][i]
if j != len(n)-1:
result[i] += [' ']

for r in result:
print(*r, sep='')