h, w = (int(x) for x in input().split())

ab=[]

ab.append(['#']*(w+2))

for _ in range(h):

    s=eval(input())

    s=list(s)

    s =['#'] + s + ['#']

    ab.append(s)

ab.append(['#']*(w+2))



for i in range(h+2):

    k=ab[i]

    print((''.join(map(str,k))))

H,W = list(map(int,input().split()))



ans = []



top = ['#']*(W+2)



ans.append(top)



for i in range(H):

    t = list(eval(input()))

    t = ['#'] + t + ['#']

    ans.append(t)



ans.append(top)



for aa in ans:

    print((''.join(map(str,aa))))
h, w = (int(x) for x in input().split())
ab = []
ab.append(["#"] * (w + 2))
for _ in range(h):
    s = eval(input())
    s = list(s)
    s = ["#"] + s + ["#"]
    ab.append(s)
ab.append(["#"] * (w + 2))
for i in range(h + 2):
    k = ab[i]
    print(("".join(map(str, k))))

H, W = list(map(int, input().split()))
ans = []
top = ["#"] * (W + 2)
ans.append(top)
for i in range(H):
    t = list(eval(input()))
    t = ["#"] + t + ["#"]
    ans.append(t)
ans.append(top)
for aa in ans:
    print(("".join(map(str, aa))))

-h, w = (int(x) for x in input().split()) -ab = [] -ab.append(["#"] * (w + 2)) -for _ in range(h): -    s = eval(input()) -    s = list(s) -    s = ["#"] + s + ["#"] -    ab.append(s) -ab.append(["#"] * (w + 2)) -for i in range(h + 2): -    k = ab[i] -    print(("".join(map(str, k)))) +H, W = list(map(int, input().split())) +ans = [] +top = ["#"] * (W + 2) +ans.append(top) +for i in range(H): +    t = list(eval(input())) +    t = ["#"] + t + ["#"] +    ans.append(t) +ans.append(top) +for aa in ans: +    print(("".join(map(str, aa))))