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

int main()
{
    string p;
    char c1,c2,c;
    int a,b,i;
    cin>>p;
    cin>>a>>b;
    c1=p[0];
    c2=p[1];
    p="";
    
    if(b>a){
        c=c1;c1=c2;c2=c;}
    if(b>a+1 or a>b+1)
        cout<<"nemoguce";
    else{
        for(i=1;i<=(a+b);i++){
            if(i%2!=0)p+=c1;
            else p+=c2;}
        cout<<p;}
    return 0;
}