#include <iostream>

using namespace std;

int main()
{
    char c1;
    char c2;

    cin >> c1 >> c2;

    string s1 (1,c1);
    string s2 (1,c2);
    string s = "";

    int x1, x2;

    cin >> x1 >> x2;

    if(x1 == x2)
    {
        for (int i = 0; i < x1; ++i)
            {
                s += s2 + s1;
            }
    }
    else if(abs(x1-x2) == 1)
        if (x1 < x2)
        {
            for (int i = 0; i < x1; ++i)
            {
                s += s2 + s1;
            }
            s += s2;
        }
        else
        {
            for (int i = 0; i<x2; ++i)
            {
                s += s1 + s2;
            }
            s += s1;
        }
    else cout << "nemoguce";
    cout << s;

    return 0;
}