import Control.Monad
main = do
  [h, w] <- read map . words <$> getLine
  ass <- replicateM h getLine
  output . f h w $ ass

f h w = map g h . g w

g l xs = [k l] ++ xs ++ [k l]

k l = take l . repeat $ "#"

output [] = return
output (x:xs) = putStr x >> output xs

