#include <iostream>
#include <string>


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