#include<bits/stdc++.h>
using namespace std;

int main(){
	char arr[100100];
	long long a1,a2,sm;
	char c1,c2,first;
	cin >> c1 >> c2 >> a1 >> a2;
	if(abs(a1 - a2)>1){
		cout << "nemoguce\n";
		return 0;	
	}
	max(a1, a2) == a1?swap(c1,c1):swap(c1,c2);
	sm = a1 + a2;
	for (int i = 0; i < sm;i++){
		//c1 uvek prvo
		arr[i] = c1;
		i+1 < sm?arr[i+1] = c2:c2 = c2;
		i++;	
	}
	cout << arr << "\n";
	return 0;
}