h,w=list(map(int,input().split()))

A=[list(eval(input())) for i in range(h)]

f=['#' for i in range(w+2)]

print((''.join(f)))

for i in A:

    print((''.join('#'+(''.join((i)))+'#')))

print((''.join(f)))
h,w=list(map(int,input().split()))

A=[list(eval(input())) for i in range(h)]

B=[['#' for i in range(w+2)] for i in range(h+2)]

for i in range(h):

    for j in range(w):

        B[i+1][j+1]=A[i][j]

for b in B:

    print((''.join(b)))
h, w = list(map(int, input().split()))
A = [list(eval(input())) for i in range(h)]
f = ["#" for i in range(w + 2)]
print(("".join(f)))
for i in A:
    print(("".join("#" + ("".join((i))) + "#")))
print(("".join(f)))

h, w = list(map(int, input().split()))
A = [list(eval(input())) for i in range(h)]
B = [["#" for i in range(w + 2)] for i in range(h + 2)]
for i in range(h):
    for j in range(w):
        B[i + 1][j + 1] = A[i][j]
for b in B:
    print(("".join(b)))

-f = ["#" for i in range(w + 2)] -print(("".join(f))) -for i in A: -    print(("".join("#" + ("".join((i))) + "#"))) -print(("".join(f))) +B = [["#" for i in range(w + 2)] for i in range(h + 2)] +for i in range(h): +    for j in range(w): +        B[i + 1][j + 1] = A[i][j] +for b in B: +    print(("".join(b)))