#include <iostream>
#include <string>
#include <vector>

using namespace std;

char abacus[8][5];

void init() {
    for (int i = 0; i < 8; i++) {
        if (i == 2) {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = '=';
            }
        } else {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = ' ';
            }
        }
    }
}

int power(int n, int a) {
    int acc = 1;
    for (int i = 0; i < a; i++) {
        acc *= n;
    }
    return acc;
}

void set(int n) {
    for (int i = 4; 0 <= i; i--) {
        int index = 4 - i;
        int d = n / power(10, i);
//        cout << "i: " << i << endl;
//        cout << "d: " << d << endl;
        if (d < 5) {
            abacus[0][index] = '*';
            abacus[1][index] = ' ';
        } else {
            abacus[0][index] = ' ';
            abacus[1][index] = '*';
            d -= 5;
        }
        for (int j = 3; j < 8; j++) {
            abacus[j][index] = '*';
        }
        abacus[d+3][index] = ' ';
        n = n - n / power(10, i) * power(10, i);
    }
}

int main() {
    int n;
    cin >> n;
    init(); set(n);
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 5; j++) {
            cout << abacus[i][j];
        }
        cout << endl;
    }
    while (cin >> n) {
        init();
        set(n);
        cout << endl;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 5; j++) {
                cout << abacus[i][j];
            }
            cout << endl;
        }
    }
    return 0;
}