#include <iostream>
#include <cstring>

using namespace std;

int main() {
    ios::sync_with_stdio(false); cout.tie(0);
	int a, b;
	char c1, c2;
	cin >> c1 >> c2;
	cin >> a >> b;
	if (c1 == c2 || abs(a - b) >= 2 || a <= 0 || b <= 0)
		cout << "nemoguce";
	else {
		if (b > a) {
			swap(a, b);
			swap(c1, c2);
		}
		while (a != 0 || b != 0) {
			if (a > 0) {
				cout << c1;
				a--;
			}
			if (b > 0) {
				cout << c2;
				b--;
			}
		}
	}

	return 0;
}