#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int a1,a2;
    char c1,c2;

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

    if(c1==c2 || abs(a1-a2)>1 || a1==0 || a2==0)
        cout<<"nemoguce"<<endl;

    else
    {
        if(a1==a2)
            for(int i=0; i<a2; i++)
                cout<<c1<<c2;

        else if(a1>a2)
        {
            for(int i=0; i<a2; i++)
                cout<<c1<<c2;
            cout<<c1;
        }

        else
        {
            for(int i=0; i<a1; i++)
                cout<<c2<<c1;
            cout<<c2;
        }
    }

    return 0;
}