#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin >> s;
    char c1 = s[0], c2 = s[1];
    int a, b;
    cin >> a >> b;

    if(abs(a-b) <= 1)
    {
        if(a >= b)
        {
            while(a>0)
            {
                a--;
                cout << c1;
                if(b>0)
                {
                    b--;
                    cout << c2;
                }
            }
        }
        else
        {
            while(b>0)
            {
                b--;
                cout << c2;
                if(a>0)
                {
                    a--;
                    cout << c1;
                }
            }
        }

    }
    else
        cout << "nemoguce";
    return 0;
}