#include <iostream>
#include <string>
using namespace std;
int main()
{
    string rec, str;
    cin >> rec;
    char a = rec[0]; char b = rec[1];
    int n, m;
    cin >> n >> m;
    char pr, dr;
    if (abs(n - m) > 1)cout << "nemoguce";
    else {
        if (n >= m) {
            pr = a;
            dr = b;
        }
        else {
            pr = b;
            dr = a;
        }
        for (int i = 0; i < n + m; i++)
        {
            if (i % 2 == 0)str += pr;
            else str += dr;
        }
        cout << str;
    }
    return 0;
}