The final round of Bayan Programming Contest will be held in Tehran, and the participants will be carried around with a yellow bus. The bus has 34 passenger seats: 4 seats in the last row and 3 seats in remaining rows.  [Image] 

The event coordinator has a list of k participants who should be picked up at the airport. When a participant gets on the bus, he will sit in the last row with an empty seat. If there is more than one empty seat in that row, he will take the leftmost one. 

In order to keep track of the people who are on the bus, the event coordinator needs a figure showing which seats are going to be taken by k participants. Your task is to draw the figure representing occupied seats.


-----Input-----

The only line of input contains integer k, (0 ≤ k ≤ 34), denoting the number of participants.


-----Output-----

Print the figure of a bus with k passengers as described in sample tests. Character '#' denotes an empty seat, while 'O' denotes a taken seat. 'D' is the bus driver and other characters in the output are for the purpose of beautifying the figure. Strictly follow the sample test cases output format. Print exactly six lines. Do not output extra space or other characters.


-----Examples-----
Input
9

Output
+------------------------+
|O.O.O.#.#.#.#.#.#.#.#.|D|)
|O.O.O.#.#.#.#.#.#.#.#.|.|
|O.......................|
|O.O.#.#.#.#.#.#.#.#.#.|.|)
+------------------------+

Input
20

Output
+------------------------+
|O.O.O.O.O.O.O.#.#.#.#.|D|)
|O.O.O.O.O.O.#.#.#.#.#.|.|
|O.......................|
|O.O.O.O.O.O.#.#.#.#.#.|.|)
+------------------------+

Difficulty: interview

Starter code:

Solutions:
a = [
"+------------------------+",
"|#.#.#.#.#.#.#.#.#.#.#.|D|)",
"|#.#.#.#.#.#.#.#.#.#.#.|.|",
"|#.......................|",
"|#.#.#.#.#.#.#.#.#.#.#.|.|)",
"+------------------------+"
]
n = int(input())
row = 1
pos = 1

for i in range(n):
    a[pos] = a[pos][:row] + 'O' + a[pos][row + 1:]
    pos += 1
    if row != 1 and pos == 3:
        pos += 1
    if pos > 4:
        pos = 1
        row += 2

for x in a:
    print(x)


3

import sys

slika = """+------------------------+
|#.#.#.#.#.#.#.#.#.#.#.|D|)
|#.#.#.#.#.#.#.#.#.#.#.|.|
|#.......................|
|#.#.#.#.#.#.#.#.#.#.#.|.|)
+------------------------+"""

def __starting_point():
    st = int(sys.stdin.readline())
    lines = [list(line) for line in slika.split('\n')]
    w = min(len(line) for line in lines)
    for k in range(w):
        if st == 0:
            break
        for l in range(len(lines)):
            if st == 0:
                break
            if lines[l][k] == '#':
                lines[l][k] = 'O'
                st -= 1
    
    for line in lines:
        print(''.join(line))

__starting_point()

k = int(input())
s = [""] * 6
s[0] = "+------------------------+"
s[1] = "|#.#.#.#.#.#.#.#.#.#.#.|D|)"
s[2] = "|#.#.#.#.#.#.#.#.#.#.#.|.|"
s[3] = "|#.......................|"
s[4] = "|#.#.#.#.#.#.#.#.#.#.#.|.|)"
s[5] = "+------------------------+"

curs = 1
while k > 0:
    while not "#" in s[curs]:
        curs = 1 + curs % 4
    x = s[curs].index("#")
    s[curs] = s[curs][:x] + "O" + s[curs][x + 1:]
    curs = 1 + curs % 4
    k -= 1
for i in s:
    print(i)

bus = [
list('+------------------------+'),
list('|#.#.#.#.#.#.#.#.#.#.#.|D|)'),
list('|#.#.#.#.#.#.#.#.#.#.#.|.|'),
list('|#.......................|'),
list('|#.#.#.#.#.#.#.#.#.#.#.|.|)'),
list('+------------------------+'),
]

n = int(input())

for i in range(n):
    ok = False
    for r in range(11):
        if ok:
            break
        r_num = 2 * r + 1
        for j in range(1, 5):
            if ok:
                break
            if bus[j][r_num] == '#':
                bus[j][r_num] = 'O'
                ok = True

for s in bus:
    print(''.join(s))


s = ['+------------------------+',
'|#.#.#.#.#.#.#.#.#.#.#.|D|)',
'|#.#.#.#.#.#.#.#.#.#.#.|.|',
'|#.......................|',
'|#.#.#.#.#.#.#.#.#.#.#.|.|)',
'+------------------------+']
k = int(input())

for _ in range(k):
    fnd = False
    for j in range(22):
        if fnd:
            break
        for i in range(6):
            if s[i][j] == '#':
                s[i] = s[i][:j] + 'O' + s[i][j + 1:]
                fnd = True
                break
print('\n'.join(s))


n = int(input())
a = [0]*11
if n < 4:
    a[0] = n
    n = 0
else:
    a[0] = 4
    n -= 4
    i = 1
    while n > 0:
        if n < 3:
            a[i] = n
            n = 0
        else:
            a[i] = 3
            n -= 3
        i+=1

def pb(x):
    nonlocal a
    for i in a[1:]:
        print('O' if i >= x else '#', end='.')
print('+------------------------+')
print(end='|'); print('O' if a[0] >= 1 else '#', end='.'); 
pb(1); print('|D|)')
print(end='|'); print('O' if a[0] >= 2 else '#', end='.'); 
pb(2); print('|.|')
print(end='|'); print('O' if a[0] >= 3 else '#', end=''); print('.......................|')
print(end='|'); print('O' if a[0] >= 4 else '#', end='.'); 
pb(3); print('|.|)')
print('+------------------------+')


A = '''+------------------------+
|#.#.#.#.#.#.#.#.#.#.#.|D|)
|#.#.#.#.#.#.#.#.#.#.#.|.|
|#.......................|
|#.#.#.#.#.#.#.#.#.#.#.|.|)
+------------------------+'''
B = A.split()

for i in range(6):
    B[i] = list(B[i])
k = int(input())

for i in range(len(B[0])):
    for j in range(6):
        if B[j][i] == '#' and k > 0:
            B[j][i] = 'O'
            k -= 1

for i in range(6):
    print(''.join(B[i]))


ans= '\n'.join(['+------------------------+'
,'|0.4.7.A.(.G.J.M.P.S.V.|D|)',
'|1.5.8.B.E.H.K.N.Q.T.W.|.|'
,'|2.......................|',
'|3.6.9.C.F.I.L.s.R.U.X.|.|)',
'+------------------------+'])

line = "0123456789ABC(EFGHIJKLMNsPQRSTUVWX"
n = int(input())
for i in range(n):
    ans = ans.replace(line[i],'O')
  #  print(ans)
 #   print("")
#print("_________________________")
for i in range(n,34,1):
    ans = ans.replace(line[i],"#")
 #   print(ans)
  #  print("")
print(ans)

n=int(input())
print("+------------------------+")
print("|",end="")
a=0
b=0
c=0
if n>=4:
   for i in range(n-4):
      if i%3==0:a+=1
      elif i%3==1:b+=1
      else:c+=1

if n>=1:print("O.",end="")
else:print("#.",end="")
for i in range(1,11):
   if i>a:print("#.",end="")
   else:print("O.",end="")
print("|D|)")

print("|",end="")
if n>=2:print("O.",end="")
else:print("#.",end="")
for i in range(1,11):
   if i>b:print("#.",end="")
   else:print("O.",end="")
print("|.|")

print("|",end="")
if n>=3:print("O.",end="")
else:print("#.",end="")
print("......................|")

print("|",end="")
if n>=4:print("O.",end="")
else:print("#.",end="")
for i in range(1,11):
   if i>c:print("#.",end="")
   else:print("O.",end="")
print("|.|)")

print("+------------------------+")

a = [list('+------------------------+'), 
list('|#.#.#.#.#.#.#.#.#.#.#.|D|)'),
list('|#.#.#.#.#.#.#.#.#.#.#.|.|'),
list('|#.......................|'),
list('|#.#.#.#.#.#.#.#.#.#.#.|.|)'), 
list('+------------------------+')]
a = list(a)
k = int(input())
if k < 4:
    for i in range(k):
        a[1 + i][1] = 'O'
else:
    for i in range(4):
        a[1 + i][1] = 'O'    
    k -= 4
    for i in range(k):
        r = i % 3
        if r == 0:
            a[1][i // 3 * 2 + 3] = 'O'
        elif r == 1:
                a[2][i // 3 * 2 + 3] = 'O'            
        elif r == 2:
                a[4][i // 3 * 2 + 3] = 'O'                    
for i in a:
    print(''.join(i))

def main():
    n = int(input())
    print("+------------------------+")
    b1 = 0
    if n == 0:
        b1 = 0
    elif 1 <= n <= 4:
        b1 = 1
    else:
        b1 = (n + 1) // 3
    if 0 <= n <= 1:
        b2 = 0
    elif 2 <= n <= 5:
        b2 = 1
    else:
        b2 = n // 3
    b3 = 0
    if n < 3:
        b3 = 0
    else:
        b3 = 1
    b4 = 0
    if n <= 3:
        b4 = 0
    else:
        b4 = (n - 1) // 3
    print("|", end = '')
    for i in range(1, 12):
        if i <= b1:
            print('O.', end = '')
        else:
            print('#.', end = '')
    print('|D|)')
    print("|", end = '')
    for i in range(1, 12):
        if i <= b2:
            print('O.', end = '')
        else:
            print('#.', end = '')
    print('|.|')
    if b3 == 0:
        print("|#.......................|")
    else:
        print("|O.......................|")
    print("|", end = '')
    for i in range(1, 12):
        if i <= b4:
            print('O.', end = '')
        else:
            print('#.', end = '')
    print('|.|)')
    print("+------------------------+")



main()


n = int(input())
A = []
A.append(list('+------------------------+'))
A.append(list('|#.#.#.#.#.#.#.#.#.#.#.|D|)'))
A.append(list('|#.#.#.#.#.#.#.#.#.#.#.|.|'))
A.append(list('|#.......................|'))
A.append(list('|#.#.#.#.#.#.#.#.#.#.#.|.|)'))
A.append(list('+------------------------+'))
for k in range(n):
	j = i = 1
	while A[i][j] != '#':
		i = 1
		while i < 5 and A[i][j] != '#':
			i += 1
		if A[i][j] != '#':
			j += 2
	A[i][j] = 'O'
for line in A:
	print(''.join(line))


k = int(input())
print('+------------------------+')
if k <= 4:
    if k > 0:
        print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
    else:
        print('|#.#.#.#.#.#.#.#.#.#.#.|D|)')
    if k > 1:
        print('|O.#.#.#.#.#.#.#.#.#.#.|.|')
    else:
        print('|#.#.#.#.#.#.#.#.#.#.#.|.|')
    if k > 2:
        print('|O.......................|')
    else:
        print('|#.......................|')
    if k > 3:
        print('|O.#.#.#.#.#.#.#.#.#.#.|.|)')
    else:
        print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
else:
    k -= 4
    first = k // 3 + 1
    if k % 3 > 0:
        first += 1
    second = k // 3 + 1
    if k % 3 > 1:
        second += 1
    third = k // 3 + 1
    
    print('|', 'O.' * first, '#.' * (11 - first), '|D|)', sep = '')
    print('|', 'O.' * second, '#.' * (11 - second), '|.|', sep = '')
    print('|O.......................|')
    print('|', 'O.' * third, '#.' * (11 - third), '|.|)', sep = '')
print('+------------------------+')

n = int(input())
pls = [['#','#','#','#'] for i in range(11)]
for i in range(1, 11):
    pls[i][2] = ''
for i in range(11):
    for j in range(4):
        if n == 0:
            break
        if pls[i][j] != '':
            pls[i][j] = 'O'
            n -= 1
print("+------------------------+")
print("|" + pls[0][0], pls[1][0], pls[2][0], pls[3][0], pls[4][0], pls[5][0], pls[6][0], pls[7][0], pls[8][0], pls[9][0], pls[10][0], "|D|)", sep='.')
print("|" + pls[0][1], pls[1][1], pls[2][1], pls[3][1], pls[4][1], pls[5][1], pls[6][1], pls[7][1], pls[8][1], pls[9][1], pls[10][1], "|.|", sep='.')
print("|" + pls[0][2], pls[1][2], pls[2][2], pls[3][2], pls[4][2], pls[5][2], pls[6][2], pls[7][2], pls[8][2], pls[9][2], pls[10][2], "............|", sep='.')
print("|" + pls[0][3], pls[1][3], pls[2][3], pls[3][3], pls[4][3], pls[5][3], pls[6][3], pls[7][3], pls[8][3], pls[9][3], pls[10][3], "|.|)", sep='.')
print("+------------------------+")

# CF BAYAN WARMUP
# A

k = int(input())

if k == 0:
    print("+------------------------+")
    print("|#.#.#.#.#.#.#.#.#.#.#.|D|)")
    print("|#.#.#.#.#.#.#.#.#.#.#.|.|")
    print("|#.......................|")
    print("|#.#.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 1:
    print("+------------------------+")
    print("|O.#.#.#.#.#.#.#.#.#.#.|D|)")
    print("|#.#.#.#.#.#.#.#.#.#.#.|.|")
    print("|#.......................|")
    print("|#.#.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 2:
    print("+------------------------+")
    print("|O.#.#.#.#.#.#.#.#.#.#.|D|)")
    print("|O.#.#.#.#.#.#.#.#.#.#.|.|")
    print("|#.......................|")
    print("|#.#.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 3:
    print("+------------------------+")
    print("|O.#.#.#.#.#.#.#.#.#.#.|D|)")
    print("|O.#.#.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|#.#.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 4:
    print("+------------------------+")
    print("|O.#.#.#.#.#.#.#.#.#.#.|D|)")
    print("|O.#.#.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.#.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 5:
    print("+------------------------+")
    print("|O.O.#.#.#.#.#.#.#.#.#.|D|)")
    print("|O.#.#.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.#.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 6:
    print("+------------------------+")
    print("|O.O.#.#.#.#.#.#.#.#.#.|D|)")
    print("|O.O.#.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.#.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 7:
    print("+------------------------+")
    print("|O.O.#.#.#.#.#.#.#.#.#.|D|)")
    print("|O.O.#.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 8:
    print("+------------------------+")
    print("|O.O.O.#.#.#.#.#.#.#.#.|D|)")
    print("|O.O.#.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 9:
    print("+------------------------+")
    print("|O.O.O.#.#.#.#.#.#.#.#.|D|)")
    print("|O.O.O.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.#.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 10:
    print("+------------------------+")
    print("|O.O.O.#.#.#.#.#.#.#.#.|D|)")
    print("|O.O.O.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 11:
    print("+------------------------+")
    print("|O.O.O.O.#.#.#.#.#.#.#.|D|)")
    print("|O.O.O.#.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 12:
    print("+------------------------+")
    print("|O.O.O.O.#.#.#.#.#.#.#.|D|)")
    print("|O.O.O.O.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.#.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 13:
    print("+------------------------+")
    print("|O.O.O.O.#.#.#.#.#.#.#.|D|)")
    print("|O.O.O.O.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 14:
    print("+------------------------+")
    print("|O.O.O.O.O.#.#.#.#.#.#.|D|)")
    print("|O.O.O.O.#.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 15:
    print("+------------------------+")
    print("|O.O.O.O.O.#.#.#.#.#.#.|D|)")
    print("|O.O.O.O.O.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.#.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 16:
    print("+------------------------+")
    print("|O.O.O.O.O.#.#.#.#.#.#.|D|)")
    print("|O.O.O.O.O.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 17:
    print("+------------------------+")
    print("|O.O.O.O.O.O.#.#.#.#.#.|D|)")
    print("|O.O.O.O.O.#.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 18:
    print("+------------------------+")
    print("|O.O.O.O.O.O.#.#.#.#.#.|D|)")
    print("|O.O.O.O.O.O.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.#.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 19:
    print("+------------------------+")
    print("|O.O.O.O.O.O.#.#.#.#.#.|D|)")
    print("|O.O.O.O.O.O.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 20:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.#.#.#.#.|D|)")
    print("|O.O.O.O.O.O.#.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 21:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.#.#.#.#.|D|)")
    print("|O.O.O.O.O.O.O.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.#.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 22:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.#.#.#.#.|D|)")
    print("|O.O.O.O.O.O.O.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 23:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.#.#.#.|D|)")
    print("|O.O.O.O.O.O.O.#.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 24:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.#.#.#.|D|)")
    print("|O.O.O.O.O.O.O.O.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.#.#.#.#.|.|)")
    print("+------------------------+")

if k == 25:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.#.#.#.|D|)")
    print("|O.O.O.O.O.O.O.O.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.#.#.#.|.|)")
    print("+------------------------+")

if k == 26:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.#.#.|D|)")
    print("|O.O.O.O.O.O.O.O.#.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.#.#.#.|.|)")
    print("+------------------------+")

if k == 27:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.#.#.|D|)")
    print("|O.O.O.O.O.O.O.O.O.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.#.#.#.|.|)")
    print("+------------------------+")

if k == 28:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.#.#.|D|)")
    print("|O.O.O.O.O.O.O.O.O.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.O.#.#.|.|)")
    print("+------------------------+")

if k == 29:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.O.#.|D|)")
    print("|O.O.O.O.O.O.O.O.O.#.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.O.#.#.|.|)")
    print("+------------------------+")

if k == 30:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.O.#.|D|)")
    print("|O.O.O.O.O.O.O.O.O.O.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.O.#.#.|.|)")
    print("+------------------------+")

if k == 31:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.O.#.|D|)")
    print("|O.O.O.O.O.O.O.O.O.O.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.O.O.#.|.|)")
    print("+------------------------+")


if k == 32:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.O.O.|D|)")
    print("|O.O.O.O.O.O.O.O.O.O.#.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.O.O.#.|.|)")
    print("+------------------------+")

if k == 33:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.O.O.|D|)")
    print("|O.O.O.O.O.O.O.O.O.O.O.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.O.O.#.|.|)")
    print("+------------------------+")

if k == 34:
    print("+------------------------+")
    print("|O.O.O.O.O.O.O.O.O.O.O.|D|)")
    print("|O.O.O.O.O.O.O.O.O.O.O.|.|")
    print("|O.......................|")
    print("|O.O.O.O.O.O.O.O.O.O.O.|.|)")
    print("+------------------------+")


a = []
a.append('+------------------------+' )
a.append('|#.#.#.#.#.#.#.#.#.#.#.|D|)')
a.append('|#.#.#.#.#.#.#.#.#.#.#.|.|' )
a.append('|#.......................|' )
a.append('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
a.append('+------------------------+' )
a = list(map(list, a))
curr = [0, 0]
n = int(input())
while n > 0:
    if a[curr[0]][curr[1]] == '#':
        a[curr[0]][curr[1]] = 'O'
        n -= 1
    curr[0] += 1
    if curr[0] >= 6:
        curr[0] = 0
        curr[1] += 1
for i in range(5):
    for j in a[i][:-1]:
        print(j, end = '')
    print(a[i][-1])
for j in a[5]:
        print(j, end = '')

n=int(input())
a='+'+'-'*24+'+'
print(a)


b='|'
if n>=1:b=b+'O.'
else:b=b+'#.'
for i in range(1,11):
    if 3*i+2>n:b+='#.'
    else:b+='O.'
b+='|D|)'
print(b)

b='|'
if n>=2:b=b+'O.'
else:b=b+'#.'
for i in range(1,11):
    if 3*i+3>n:b+='#.'
    else:b+='O.'
b+='|.|'
print(b)



b='|'
if n>=3:b=b+'O.'
else:b=b+'#.'
b=b+'.'*22
b+='|'
print(b)

b='|'
if n>=4:b=b+'O.'
else:b=b+'#.'
for i in range(1,11):
    if 3*i+4>n:b+='#.'
    else:b+='O.'
b+='|.|)'
print(b)




print(a)

'''
Created on Oct 5, 2014

@author: Ismael
'''

def printBus(lastRow,otherRows):
    s = "+------------------------+\n"
    for i in range(4):
        s += "|"+lastRow[i]+"."
        for j in range(10):
            if(i == 2):
                s += ".."
            elif(i == 3):
                s += otherRows[j][i-1]+"."
            else:
                s += otherRows[j][i]+"."
        if(i == 0):
            s += "|D|)"
        elif(i == 1):
            s += "|.|"
        elif(i == 2):
            s += "..|"
        else:
            s += "|.|)"
        s += "\n"
    s += "+------------------------+"
    print(s)


def solve(n):
    lastRow = []
    otherRows = [[]]
    while(n>0):
        if(len(lastRow)<4):
            lastRow.append('O')
        else:
            if(len(otherRows[-1])<3):
                otherRows[-1].append('O')
            else:
                otherRows.append(['O'])
        n -= 1
    otherRows += [[] for _ in range(10-len(otherRows))]
    lastRow += (4-len(lastRow))*['#']
    for row in otherRows:
        row += (3-len(row))*['#']
    printBus(lastRow,otherRows)

n = int(input())
solve(n)

__author__ = 'hamed1soleimani'

lines = list()
lines.append('+------------------------+')
lines.append('|#.#.#.#.#.#.#.#.#.#.#.|D|)')
lines.append('|#.#.#.#.#.#.#.#.#.#.#.|.|')
lines.append('|#.......................|')
lines.append('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
lines.append('+------------------------+')

n = int(input())

while True:
    if n == 0:
        break
    idx = list()
    for m in range(1, 5):
        idx.append(lines[m].find('#'))
    while True:
        if idx.count(-1) > 0:
            idx.remove(-1)
        else:
            break
    x = min(idx)
    if lines[1].find('#') == x:
        lines[1] = lines[1].replace('#', 'O', 1)
        n -= 1
    elif lines[2].find('#') == x:
        lines[2] = lines[2].replace('#', 'O', 1)
        n -= 1
    elif lines[3].find('#') == x:
        lines[3] = lines[3].replace('#', 'O', 1)
        n -= 1
    elif lines[4].find('#') == x:
        lines[4] = lines[4].replace('#', 'O', 1)
        n -= 1

for ss in lines:
    print(ss)


k = int(input())
s = [list('+------------------------+'),
     list('|#.#.#.#.#.#.#.#.#.#.#.|D|)'),
     list('|#.#.#.#.#.#.#.#.#.#.#.|.|'),
     list('|#.......................|'),
     list('|#.#.#.#.#.#.#.#.#.#.#.|.|)'),
     list('+------------------------+')]

row = 1
c = 1
for i in range(k):
    s[c][row] = 'O'
    c += 1

    if row > 1 and c == 3:
        c += 1
    if c == 5:
        c = 1
        row += 2
        
for i in range(6):
    print(''.join([ss for ss in s[i]]))

k=int(input())
i=1
print("+------------------------+")
n=k
r1=0
r2=0
r3=0
r4=0
if k>=4:
    n-=4
    r1=1
    r2=1
    r4=1
    r3=1
else:
    if n>0:
        r1=1
        n-=1
    if n>0:
        r2=1
        n-=1
    if n>0:
        r3=1
        n-=1
r4+=n//3
r1+=n//3
r2+=n//3
if n%3==1:
    r1+=+1
elif n%3==2:
    r1+=1
    r2+=1
print('|'+'O.'*r1+'#.'*(11-r1)+'|D|)')
print('|'+'O.'*r2+'#.'*(11-r2)+'|.|')
print('|'+'O'*r3+'#'*(1-r3)+'.......................|')
print('|'+'O.'*r4+'#.'*(11-r4)+'|.|)')
print("+------------------------+")

k = int(input())
print('+------------------------+')
a = (k - 4) // 3
b = (k - 4) % 3
if k == 0:
    print('|#.#.#.#.#.#.#.#.#.#.#.|D|)')
    print('|#.#.#.#.#.#.#.#.#.#.#.|.|')
    print('|#.......................|')
    print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
elif k == 1:
    print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
    print('|#.#.#.#.#.#.#.#.#.#.#.|.|')
    print('|#.......................|')
    print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
elif k == 2:
    print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
    print('|O.#.#.#.#.#.#.#.#.#.#.|.|')
    print('|#.......................|')
    print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
elif k == 3:
    print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
    print('|O.#.#.#.#.#.#.#.#.#.#.|.|')
    print('|O.......................|')
    print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
elif k == 4:
    print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
    print('|O.#.#.#.#.#.#.#.#.#.#.|.|')
    print('|O.......................|')
    print('|O.#.#.#.#.#.#.#.#.#.#.|.|)')
elif b == 0:
    print('|O'+'.O'*a+'.#'*(10-a)+'.|D|)')
    print('|O'+'.O'*a+'.#'*(10-a)+'.|.|')
    print('|O.......................|')
    print('|O'+'.O'*a+'.#'*(10-a)+'.|.|)')
elif b == 1:
    print('|O'+'.O'*(a+1)+'.#'*(10-a-1)+'.|D|)')
    print('|O'+'.O'*a+'.#'*(10-a)+'.|.|')
    print('|O.......................|')
    print('|O'+'.O'*a+'.#'*(10-a)+'.|.|)')
elif b == 2:
    print('|O'+'.O'*(a+1)+'.#'*(10-a-1)+'.|D|)')
    print('|O'+'.O'*(a+1)+'.#'*(10-a-1)+'.|.|')
    print('|O.......................|')
    print('|O'+'.O'*a+'.#'*(10-a)+'.|.|)')    
print('+------------------------+')

import math

#input

k=int(input())



#variables

def row(x,y):
	print('|O.'+'O.'*x+'#.'*(10-x)+'|'+y)

#main

print('+------------------------+')
if k==0:
	print('|#.#.#.#.#.#.#.#.#.#.#.|D|)')
	print('|#.#.#.#.#.#.#.#.#.#.#.|.|')
	print('|#.......................|')
	print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
	print('+------------------------+')
	quit()
if k==1:
	print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
	print('|#.#.#.#.#.#.#.#.#.#.#.|.|')
	print('|#.......................|')
	print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
	print('+------------------------+')
	quit()
if k==2:
	print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
	print('|O.#.#.#.#.#.#.#.#.#.#.|.|')
	print('|#.......................|')
	print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
	print('+------------------------+')
	quit()
if k==3:
	print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
	print('|O.#.#.#.#.#.#.#.#.#.#.|.|')
	print('|O.......................|')
	print('|#.#.#.#.#.#.#.#.#.#.#.|.|)')
	print('+------------------------+')
	quit()
if k==4:
	print('|O.#.#.#.#.#.#.#.#.#.#.|D|)')
	print('|O.#.#.#.#.#.#.#.#.#.#.|.|')
	print('|O.......................|')
	print('|O.#.#.#.#.#.#.#.#.#.#.|.|)')
	print('+------------------------+')
	quit()

if ((k-4)%3)==1:
	row(math.ceil((k-4)/3),'D|)')
	row(math.ceil((k-4)/3)-1,'.|')
	print('|O.......................|')
	row(math.ceil((k-4)/3)-1,'.|)')
if ((k-4)%3)==2:
	row(math.ceil((k-4)/3),'D|)')
	row(math.ceil((k-4)/3),'.|')
	print('|O.......................|')
	row(math.ceil((k-4)/3)-1,'.|)')
if ((k-4)%3)==0:
	row(math.ceil((k-4)/3),'D|)')
	row(math.ceil((k-4)/3),'.|')
	print('|O.......................|')
	row(math.ceil((k-4)/3),'.|)')
print('+------------------------+')