#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    if (!(cin >> n >> m)) return 0;

    vector<vector<int>> a(n, vector<int>(m));
    int H = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
            H = max(H, a[i][j]);
        }
    }

    if (H == 0) {
        return 0;
    }

    const vector<string> cube = {
        "..+-+",
        "./ /|",
        "+-+ +",
        "| |/.",
        "+-+.."
    };

    const int height = 2 * (H + n - 1) + 3;
    const int width  = 2 * (m + n - 1) + 3;

    vector<string> canvas(height, string(width, '.'));

    for (int i = 0; i < n; ++i) {               // back -> front
        for (int j = 0; j < m; ++j) {           // left -> right
            for (int k = 1; k <= a[i][j]; ++k) { // bottom -> top
                int row = 2 * (H - k + i);
                int col = 2 * (j + (n - 1 - i));
                for (int r = 0; r < 5; ++r) {
                    for (int c = 0; c < 5; ++c) {
                        char ch = cube[r][c];
                        if (ch != '.') {
                            canvas[row + r][col + c] = ch;
                        }
                    }
                }
            }
        }
    }

    for (string &line : canvas) {
        for (char &ch : line) {
            if (ch == '.') ch = ' ';
        }
        while (!line.empty() && line.back() == ' ') {
            line.pop_back();
        }
    }

    while (!canvas.empty() && canvas.back().empty()) {
        canvas.pop_back();
    }

    for (int i = 0; i < (int)canvas.size(); ++i) {
        cout << canvas[i] << '\n';
    }

    return 0;
}
