#include <iostream>
//#include <fstream>
//#include <iomanip>
#include <cmath>
//#include <algorithm>
//#include <string>
//#include <vector>
//#include <utility>
//#include <map>
//#include <ctime>
//#include <cctype>
//#include <cstdlib>
//#include <limits>
//#include <numeric>
//#include <mycpp.h>

using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(false);
	string s;
	char c1, c2;
	int a1, a2;
	cin >> s;
	c1 = s[0];
	c2 = s[1];
	cin >> a1 >> a2;
	if(abs(a1 - a2) > 1)
		cout << "nemoguce" << endl;
	else if(a1 == a2)
	{
		for(int i = 0; i < a1; i++)
			cout << c1 << c2;
	}
	else if(a1 > a2)
	{
		cout << c1;
		for(int i = 0; i < a2; i++)
			cout << c2 << c1;
	}
	else
	{
		cout << c2;
		for(int i = 0; i < a1; i++)
			cout << c1 << c2;
	}
}