#include<iostream>
using namespace std;
    int abs(int a)
    {
        if(a>=0)return a;
        else return -a;
    }
    int main()
    {
        char c1,c2, x, y;
        int a1,a2, n;
        cin>>c1>>c2;
        cin>>a1>>a2;
        int p = abs(a1-a2);
        if(p==1)
        {
            if(a1<a2)
            {
                n = a1;
                x = c2;
                y = c1;
            }
            else
            {
                n = a2;
                x = c1;
                y = c2;
            }
            for(int i=1;i<2*n;i+=2)
            {
                cout<<x;
                cout<<y;
            }
            cout<<x;

        }
        else if(p==0)
        {
            n = a1;
            for(int i=1;i<2*n;i+=2)
            {
                cout<<c1;
                cout<<c2;
            }
        }
        else cout<<"nemoguce";
    }