#include <iostream>
#include <string>


int main()
{
	std::string unos;
	std::string c1, c2;
	std::cin >> unos;
	long long a1, a2;
	c1 = unos[0];
	c2 = unos[1];
	std::cin >> a1 >> a2;
	std::string ima;
	ima = c1 + c2;
	long long n;
	if (a1 >= a2)
		n = a1;
	else
		n = a2;
	for (int i = 1; i < n; i++)
	{
		if (ima.back() != c1[0] && i <= a1)
			ima += c1;
		if (ima.back() != c2[0] && i <= a2)
			ima += c2;
		else
		{
			ima = "nemoguce";
			break;
		}
	}		
	std::cout << ima;
	return 0;
}