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

int main()
{
    string str1,unos;
    int n1,n2;
    getline(cin,unos);
    char c1=unos[0],c2=unos[1];
    cin>>n1>>n2;
    if(n1==n2)
    {
        str1=unos;
       while(n1-1>0)
       {
           str1=str1+unos;
           n1--;
       }
       cout<<str1;
       return 0;
    }
    if(n1+1==n2)
    {
        str1=c2;
        while(n2-1>0)
        {
            str1=str1+c1+c2;
            n2--;
        }
        cout<<str1;
        return 0;

    }
    if(n2+1==n1)
    {
        str1=c1;
        while(n1-1>0)
        {
            str1=str1+c2+c1;
            n1--;
        }
        cout<<str1;
        return 0;
    }
    cout<<"nemoguce";
}