#include <iostream>

using namespace std;

int main()
{
    string gas;
    char s1, s2;
    int plin, cepelin;
    cin >> gas >> plin >> cepelin;
    s1 = gas[0];
    s2 = gas[1];
    if(abs(plin - cepelin) <= 1)
    {
        if(plin == cepelin)
        {
            for(int i = 0; i < plin; i++)
                cout << s1 << s2;
        }
        if(plin > cepelin)
        {
            for(int i = 0; i < cepelin; i++)
                {cout << s1 << s2;}
            cout << s1;
        }
        if(cepelin > plin)
        {
            for(int i = 0; i < cepelin; i++)
                {cout << s2 << s1;}
            cout << s2;
        }
    }
    else cout << "nemoguce";
    return 0;
}