#include <iostream>

using namespace std;

int main()
{

    string s;
    char c1, c2;
    int a1, a2, veci, manji;

    cin >> c1 >> c2;
    cin >> a1 >> a2;

    if(a1 >= a2){
        veci = a1;
        manji = a2;
    }
    else{
        veci = a2;
        manji = a1;
    }

    if(veci - manji >= 2){
        cout << "nemoguce" << endl;
    }
    else{
        if(a1 == a2){
            for(int i = 0; i < a1; i++){
                s += c1;
                s += c2;
            }
        }
        else if(a1 == manji){
            for(int i = 0; i < a1; i++){
                s += c2;
                s += c1;
            }
            s += c2;
        }
        else if(a2 == manji){
            for(int i = 0; i < a2; i++){
                s += c1;
                s += c2;
            }
            s += c1;
        }


        cout << s << endl;
    }

    return 0;
}