#include<stdio.h> int main() { int n,m,i,j; while(scanf("%d%d",&n,&m)!=EOF) { n+=2;m+=2; for(i=0;i<m;i++) { for(j=0;j<n;j++) { if(i==0&&j==0||i==0&&j==n-1||i==m-1&&j==0||i==m-1&&j==n-1)//对四个拐角判定 putchar('+'); else if(i==0||i==m-1)//对每行的-判定 putchar('-'); else if(j==0||j==n-1)//对列的|判定 putchar('|'); else putchar(' ');//对空格的判定 } putchar(' '); } putchar(' '); } return 0; }