#include<iostream>
#include<cstdio>;
using namespace std;
int main(){
char c1,c2;
c1=getchar();
c2=getchar();
int a1,a2;
cin>>a1>>a2;
int n=a1+a2;
char c[100];
c[0]=c1;
a1--;
for(int i=1;i<=n;i++){
    if(c[i-1]!=c2&&a2>0){
        c[i]=c2;
        a2--;
        continue;
    }
    if(c[i-1]!=c1&&a1>0){
        c[i]=c1;
        a1--;
        continue;
    }
    if(i==n&&a1==0&&a2==0){
        cout<<c;
    }
    else{
        cout<<"nemoguce";
    }
    return 0;
}
}