#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    cin.tie(0);
    std::ios_base::sync_with_stdio(false);

    char c1,c2;
    long int a1,a2;
    cin >> c1 >> c2;
    cin >> a1 >> a2;

    if(abs(a1-a2)>1)
    {
        cout << "nemoguce\n";
    }
    else
    {
        long int i = 0;
        long int minn = min(a1,a2);
        while(i < minn)
        {
            if(a1 >= a2)
            {
                cout << c1;
                cout << c2;

            }
            if(a2 > a1)
            {
                cout << c2;
                cout << c1;
            }
            i++;
        }
        if(a1 > a2)
            cout << c1;

        else if(a2 > a1)
                cout << c2;
    }
    return 0;
}