#include <iostream>
using namespace std;

int main(){
    int n,i,j;
    while( cin >> n ){
        int f[5], s[5];
        for(i=4;i>=0;i--){
            f[i] = n%10/5;
            s[i] = n%5;
            n /= 10;
        }
        for(i=0;i<5;i++){
            if(!f[i]) cout << "*";
            else cout << " ";
        }
        cout << endl;
        for(i=0;i<5;i++){
            if(f[i]) cout << "*";
            else cout << " ";
        }
        cout << endl;
        cout << "=====" << endl;
        for(i=0;i<5;i++){
            for(j=0;j<5;j++){
                if(s[j]==i) cout << " ";
                else cout << "*";
            }
            cout << endl;
        }
    }
    return 0;
}