#include <bits/stdc++.h>

using namespace std;

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