#include<iostream>
#include<cmath>

using namespace std;


main()
{
	char c1,c2;
	int a1,a2;
	cin>>c1>>c2;
	cin>>a1>>a2;
	
	 if(abs(a1-a2)<=1 || abs(a2-a1)<=1)
	{
		 if(a1==a2)
		{
			while(a1>0)
			{
				cout<<c1<<c2;
				a1--;
			}
		
		}
		
		else if(a1>a2)
		{
			while(a2>0)
			{
				cout<<c1<<c2;
				if(a2==1)
				{
					cout<<c1;
				}
				a2--;
			
			}
			
		}
		
		
		else if(a2>a1)
		{
			while(a1>0)
			{
				cout<<c2<<c1;
				if(a1==1)
				{
					cout<<c2;
				}
				a1--;
			
			}
			
		}
	}
	else 
	cout<<"nemoguce";

}