operator fun String.times(time: Int): String{
    return (0 until time).joinToString(""){this}
}
fun main(args:Array<String>):Unit {
    val (w, h, c) = readLine()!!.trim().split(' ').let{val (w, h, c) = it; Triple(w.toInt(), h.toInt(), c)}
    val str = Array(h){("." * w).toCharArray()}
    str[0][0] = '+'; str[0][w - 1] = '+'; str[h - 1][0] = '+'; str[h - 1][w - 1] = '+'
    for (i in 1 until w - 1) {
        str[0][i] = '-'; str[h - 1][i] = '-'
    }
    for (i in 1 until h - 1) {
        str[i][0] = '|'; str[i][w - 1] = '|'
    }
    str[h / 2][w / 2] = c.toCharArray()[0]
    println(
            str.joinToString("\n"){it.joinToString("")}
    )
}
