#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n, m;
    while (cin >> m >> n)
    {
        for (int i = 0; i <= n+1; i++)
        {
            if (i == 0 || i == n+1)
            {
                cout << "+";
                for (int j = 1; j <= m; j++)
                    cout << "-";
                cout << "+";
                cout << endl;
            }
            else
            {
                cout << "|";
                for (int j = 1; j <= m; j++)
                    cout << " ";
                cout << "|";
                cout << endl;
            }

        }
        cout << endl;
    }
}