#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    char a, b;
    cin >> a >>b;
    int n, m;
    cin >> n >> m;

    if(abs(n-m) >= 2)
        cout << "nemoguce";
    else
    {
        char x = a, y = b;

        if(a<b)
        {
        x=b;
        y=a;
        }


        for(int i = 0; i < n+m; i++)
            if(i%2 == 0)
                cout << x;
            else
                cout << y;

    }

    return 0;
}