#include <iostream>

using namespace std;

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

        if(a1==a2 || a1==a2+1 || a2==a1+1)
        {
                if(a1<a2)
                {
                        a1++;
                        a2--;
                        char t=c1;
                        c1=c2;
                        c2=t;
                }
                for(int i=0;i<n;i++)
                {
                        if(i%2==0)
                        {
                                cout<<c1;
                        }
                        else
                        {
                                cout<<c2;
                        }
                }
        }
        else
        {
                cout<<"nemoguce";
        }
        return 0;
}