fun main(array: Array<String>) {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    for(i in 1..h+2) {
        when (i) {
            1 -> {
                repeat(w+2) {
                    print("#")
                }
                println("")
            }
            h+2 -> {
                repeat(w+2) {
                    print("#")
                }
            }
            else -> {
                val s = readLine()!!
                repeat((w + 2 - s.length) / 2) {
                    print("#")
                }
                print(s)
                repeat((w + 2 - s.length) / 2) {
                    print("#")
                }
                println("")
            }
        }
    }
}