#include <iostream>

using namespace std;

int main()
{
    char pera, petra;
    cin >> pera >> petra;
    char zaj[2];
    int c1, c2;
    cin >> c1 >> c2;
    string resenje;
    if(pera == petra) cout << "nemoguce";
    else if(c1 == c2){
        for(int i = 0; i < c1; i++){
            zaj[i] = (pera + petra)* c1 ;
            resenje = zaj[i];
        }
        cout << resenje;
    }
    else if(c1 + 1 == c2){
        for(int i = 0; i < c1; i++){
            zaj[i] = (petra + pera) * c1 + petra;
            resenje = zaj[i];
        }
        cout << resenje;
    }
    else if(c2 + 1 == c1){
        for(int i = 0; i < c2; i++){
            zaj[i] = (petra + pera) * c2 + pera;
            resenje = zaj[i];
        }
        cout << resenje;
    }

    else if (c1 != c2) cout << "nemoguce";

    return 0;
}