#include <bits/stdc++.h>
using namespace std;

int main()
{
    char c1 = getchar(), c2 = getchar();
    int a1, a2, amin, r; cin >> a1 >> a2;
    r = a1 - a2; amin = min(a1, a2);

    if (abs(r) > 1 || c1 == c2)
    {
        cout << "nemoguce";
        return 0;
    }
    string out = "";

    for (int i = 0; i < amin; i++)
        out = out + c1 + c2;

    if (r == -1)
        out = c2 + out;
    
    else if (r == 1)
        out = out + c1;

    cout << out;
    return 0;
}