#include <bits/stdc++.h>

using namespace std;

int main()
{
	string s;
	int a, b;
	cin >> s;
	cin >> a >> b;
	char a1 = s[0];
	char b1 = s[1];
	if (a == b || a+1 == b || a-1 == b)
	{
		if (a == b)
			for (int i = 0; i < a; i++)
				cout << a1 << b1;
		if (a-1 == b)
		{
			for (int i = 0; i < b; i++)
				cout << a1 << b1;
			cout << a1;
		}
		if (a+1 == b)
		{
			for (int i = 0; i < a; i++)
				cout << b1 << a1;
			cout << b1;
		}
	}
	else 
		cout << "nemoguce";
}