#include <iostream>

using namespace std;

int main()
{
    char c1,c2;
    long long a,b;
    cin>>c1>>c2;
    cin>>a>>b;
    if (a==b)
    {
        for (int i=0;i<a;i++)
        {
            cout<<c1<<c2;
        }
        cout<<endl;
    }
    else if (a==b+1)
    {
        cout<<c1;
        for (int i=0;i<b;i++)
        {
            cout<<c2<<c1;
        }
        cout<<endl;
    }
    else if (b==a+1)
    {
        cout<<c2;
        for (int i=0;i<a;i++)
        {
            cout<<c1<<c2;
        }
        cout<<endl;
    }
    else
    {
        cout<<"nemoguce"<<endl;
    }
}