#include <bits/stdc++.h>

template <typename T>
auto procitaj() -> T {
	T t;
	std::cin >> t;
	return t;
}

auto main() -> int {
	const auto c1 = procitaj<char>();
	const auto c2 = procitaj<char>();
	const auto a1 = procitaj<long>();
	const auto a2 = procitaj<long>();

	if (std::abs(a1 - a2) > 1) {
		std::cout << "nemoguce\n";
		return 0;
	}

	const auto redosled = [&] {
		return a1 > a2 ? std::pair<char, char>{ c1, c2 } : std::pair<char, char>{ c2, c1 };
	}();

	for (size_t i = 0; i < std::min(a1, a2); ++i) {
		std::printf("%c%c", redosled.first, redosled.second);
	}

	if (a1 != a2) {
		std::putchar(redosled.first);
	}

	printf("\n");
}