#include <bits/stdc++.h>

using namespace std;

int main()
{
    char c1, c2;
    long long a1, a2;
    cin >> c1 >> c2;
    cin >> a1 >> a2;
    if (abs(a1 - a2) > 1) cout << "nemoguce";
    if (a1 == (a2 + 1))
    {
        for (long long i = 0; i < a1; i++)
        {
            if (i == a1 - 1) cout << c1;
            else cout << c1 << c2;
        }
    }
    if (a1 == a2) for (long long i = 0; i < a1; i++) cout << c1 << c2;
    if (a2 == (a1 + 1))
    {
        for (long long i = 0; i < a2; i++)
        {
            if (i == a2 - 1) cout << c2;
            else cout << c2 << c1;
        }
    }
    return 0;
}