W,H=open(0) for c in"+"+"|"*int(H)+"+":print(c+"- "[c>W]*int(W)+c)