#include <bits/stdc++.h>
using namespace std;
int main()
{
    char c1, c2;
    int a1, a2;
    cin >> c1 >> c2 >> a1 >> a2;
    if (abs(a1 - a2) > 1) cout << "nemoguce";
    else
    {
        vector<char> S(a1+a2);
        if (a1 > a2)
        {
            for (int i = 0; i < a1+a2; i += 2) S[i] = c1;
            for (int i = 1; i < a1+a2; i += 2) S[i] = c2;
        }
        else
        {
            for (int i = 0; i < a1+a2; i += 2) S[i] = c2;
            for (int i = 1; i < a1+a2; i += 2) S[i] = c1;
        }
        for (auto i : S) cout << i;
    }
}