#include <iostream>
#include <string>

using namespace std;

int main() {
	
	string celo;
	char c1, c2;
	long a1, a2;
	
	cin >> celo >> a1 >> a2;
	
	c1 = celo[0];
	c2 = celo[1];
	
	long l = 0;
	string novi = "";
	
	if (a1 > a2 && a1 - 1 == a2) {
		for (int i = 0; i < a2; i++) {
			novi += c1;
			novi += c2;
		}
		novi += c1;
		cout << novi;
	}
	else if(a1 + 1 == a2) {
		for (int i = 0; i < a1; i++) {
			novi += c2;
			novi += c1;
		}
		novi += c2;
		cout << novi;
	}
	else if (a1 == a2) {
		for (int i = 0; i < a2; i++) {
			novi += c1;
			novi += c2;
		}
		cout << novi;
	}
	else cout << "nemoguce";
	
	return 0;
}