program main
  implicit none
  integer :: h, w, i, j
  character(102) :: line
  character(1), allocatable :: tab(:, :)
  read(*, *) h, w
  allocate(tab(0:w + 1, 0:h + 1))
  tab(:, :) = "#"
  do i = 1, h
    read(*, *) line
    do j = 1, w
      tab(j, i) = line(j:j)
    end do
  end do
  do i = 0, h + 1
    do j = 0, w + 1
      line(j + 1:j + 1) = tab(j, i)
    end do
    write(*, "(a)") trim(line)
  end do
end program main
