#include <iostream>
#include <string>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string letters; cin >> letters;
	int first_letter_cnt, second_letter_cnt; cin >> first_letter_cnt >> second_letter_cnt;
	pair<int, char> first_letter = { first_letter_cnt, letters[0] };
	pair<int, char> second_letter = { second_letter_cnt, letters[1] };

	pair<int, char> greater_letter = max(first_letter, second_letter);
	pair<int, char> smaller_letter = min(first_letter, second_letter);
	if (greater_letter.first - smaller_letter.first <= 1)
	{
		char current_char = greater_letter.second;
		for (int i = 0; i < greater_letter.first + smaller_letter.first; i++)
		{
			cout << current_char;
			current_char = current_char == greater_letter.second ? smaller_letter.second : greater_letter.second;
		}
	}
	else
	{
		cout << "nemoguce";
	}

	return 0;
}