#include <iostream>
using namespace std;
string s,s2;
char c1,c2;
int a1,a2;
int main()
{
    cin >> s;
    cin>> a1;
    cin >> a2;
    c1=s[0];
    c2=s[1];
    if((abs(a1-a2))>=2)
        cout << "nemoguce"<<endl;
    else{
        for(int i=0;i<a1;i++){
            s2=s2+c1;
        }
        if(a2>a1)
        {

        for(int i=0;i<2*a2;i+=2){
            s2=s2.substr(0,i)+c2+s2.substr(i);
           

        }
        }
        else
        {

        for(int i=1;i<2*a2+1;i+=2){
            s2=s2.substr(0,i)+c2+s2.substr(i);
       
        }




    }
    cout << s2<<endl;

}