#include<iostream>
#include<string>
using namespace std;

int main()
{
    char c1, c2;
    int a1, a2;
    string temp;

    cin>>temp; c1 = temp[0]; c2 = temp[1];
    cin>>a1>>a2;

    if(abs(a1-a2) > 1)
        cout<<"nemoguce";
    else
    {
        string str = "";

        for(int i = 0; i < min(a1,a2); i++)
        {
            str+= c1; str+= c2;
        }

        if(a1 > a2)
            str+=c1;
        else if (a2 > a1)
            str = c2 + str;

        cout<<str;
    }
    return 0;
}