#include <iostream>
#include <string>
#include <cmath>

using namespace std;
int main()
{
	char s1, s2;
	int a, b;
	cin>>s1>>s2;
	cin>>a>>b;
	int pomocna=abs(a-b);
	if ((s1>='a'&&s1<='z')&&(s2>='a'&&s2<='z'))
	{
		if ((a>=1 && a<=50000) && (b>=1 && b<=50000))
		{
			if (pomocna>=2 || a==b)
			{
				cout<<"nemoguce"<<endl;
			}
			else if (a>b)
			{
				for (int i=0;i<b;i++)
				{
					cout<<s1<<s2;
				}
				cout<<s1;
			}
			else if (b>a)
			{
				cout<<s2;
				for (int i=0;i<a;i++)
				{
					cout<<s1<<s2;
				}
			}
			else
			for (int i=0;i<a;i++)
			{
				cout<<s1<<s2;
			}
		}
	}
	else
	return 0;
}