#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int a, b;
    cin >> a >> b;
    if(abs(a-b) > 1)
    {
        cout << "nemoguce";
    }
    else
    {
        string st = "";
        char c1 = s[0];
        char c2 = s[1];
        if(a > b)
        {
            char t = c2;
            c2 = c1;
            c1 = t;
        }
        for(int i = 0; i < a + b; i++)
        {
            if(i%2 == 0)
            {
                st += c1;
            }
            else
            {
                st += c2;
            }
        }
        cout << st;
    }
}