#include <iostream>

using namespace std;

int main()
{
    char fb, lb;
    cin>>fb>>lb;
    int fdb, ldb;
    cin>>fdb>>ldb;

    int i;
    if (ldb+1==fdb)
    {
        for(i=1;i<=ldb;i++)
            cout<<fb<<lb;
        cout<<fb;
    }
    else if (fdb+1==ldb)
    {
        for(i=1;i<=fdb;i++)
            cout<<lb<<fb;
        cout<<lb;
    }
    else if (fdb==ldb)
    {
        for(i=1;i<=ldb;i++)
            cout<<fb<<lb;
    }
    else
        cout<<"nemoguce";

    return 0;
}