#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    char c1,c2;
    cin>>c1>>c2;
    int a1,a2;
    cin>>a1>>a2;
    int n=a1, m=a2;


    if (c1!=c2)
    {
        if(1>=a1,a2<=50000)
        {
            if(abs(a1-a2)>1)
            {
                cout<<"nemoguce"<<endl;
            }

            else if((n>m) || (n<m))
            {
                if(n>m)
                {
                    cout<<c1;
                    do
                    {
                        cout<<c2<<c1;
                        m--;
                    }
                    while(m!=0);
                }
                else
                {
                    cout<<c2;
                    do
                    {
                        cout<<c1<<c2;
                        n--;
                    }
                    while(n!=0);
                }
            }
            else
            {
                do
                {
                    cout<<c1<<c2;
                    m--;
                }
                while(m!=0);
            }
        }
    }

    return 0;
}