#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;

int main()
{
	string c,c1,c2,str1,str2;
	int a1,a2,l,provera1=0,provera2=0,i,n,v;
	cin>>c;
	cout<<endl;
	c1=c[0];
	c2=c[1];
	cin>>a1>>a2;
	n=a1;
	v=a2;
	do{
		if(a1>0){
			str1+=c1;
			a1--;
		}
		if(a2>0){
			str1+=c2;
			a2--;
		}	
	}while(a1!=-1&&a2!=0);
	a1=n;
	a2=v;
	do{
		if(a2>0){
			str2+=c2;
			a2--;
		}	
		if(a1>0){
			str2+=c1;
			a1--;
		}
	}while(a1!=-1&&a2!=0);
	l=str1.length();
	for(i=0;i<l;i++)
		if(str1[i]!=str1[i+1])
			provera1++;
	for(i=0;i<l;i++)
		if(str2[i]!=str2[i+1])
			provera2++;	
	if(provera1==l){
		system("cls");
		cout<<str1<<endl;
	}
	else	
		if(provera2==l){
			system("cls");
			cout<<str2<<endl;
		}
		else{
			system("cls");
			cout<<"nemoguce"<<endl;
			exit(EXIT_SUCCESS);
		}
	return 0;
}