#include <iostream>
#include <string>

using namespace std;

int main()
{
    string c;
    
    cin >> c;
    
    char a, b;

    a = c[0];
    b = c[1];
    
    int t1, t2;
    
    cin >> t1 >> t2;
    
    
    if(t1 > (t2+2) || t2 > (t1+2))
    {
        cout << "nemoguce" << endl;
    }
    else
    {
        if(t1 > t2)
        {
            for(int i = 0;i < t2;i ++)
            {
                cout << a << b;
            }
            cout << a;
        }
        else
        if(t2 > t1)
        {
            for(int i = 0;i < t1;i ++)
            {
                cout << b << a;
            }
            cout << b;
        }
        else
        {
            for(int i = 0;i < t1;i ++)
            {
                cout << a << b;
            }
        }
    }
}