#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a1, a2;
	string c;
	cin >> c;
	char c1 = c[0];
	char c2 = c[1];
	cin >> a1 >> a2;
	if (a1 == a2)
	{


		for (int i = 1; i <= a1; i++)
		{
			cout << c2;
			cout << c1;

		}

	}
	else if (a1 + 1 == a2 || a2 + 1 == a1)
	{
		if (a1 > a2) {
			cout << c2;
			for (int i = 1; i <= a2; i++)
			{
				cout << c1;
				cout << c2;
				

			}
		}
		else if (a1 < a2) {
			cout << c1;
			for (int i = 1; i <= a1; i++)
			{
				cout << c2;
				cout << c1;

			}


		}
		



	}
	else
		cout << "nemoguce";
}