#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	char s[3];
	int a,b,i;
	cin>>s;
	cin>>a>>b;
    char s1=s[0];
	char s2=s[1];
	if (abs(a-b)>1)
		cout<<"nemoguce";
	else if (a>b)
		{
			for (i=0;i<b;i++)
               cout<<s1<<s2;
			cout<<s1;
		}
		else if (b>a)
		{
			for (i=0;i<a;i++)
				cout<<s2<<s1;
			cout<<s2;
		}
		else 
		{
			for (i=0;i<a;i++)
				cout<<s2<<s1;
		}
	return 0;
}