#include<iostream>
using namespace std;
int main () {
	ios_base::sync_with_stdio(false);
	char c1, c2;
	int a1, a2;
	cin>>c1>>c2;
	cin>>a1>>a2;
	if (a1<a2) {
		a1+=a2; a2=a1-a2; a1-=a2; 
	(c1^=c2), (c2^=c1), (c1^=c2); 
	}
	if (a1-a2>1) cout<<"nemoguce";
	else {		
		string s="";
	while (a1!=0 || a2!=0) {
		if (a1!=0) {
			s.push_back(c1); 	a1--;
		}
		if (a2!=0) { 
			s.push_back(c2); a2--;
		 }

			
		
	}
	cout<<s;
	}
		
	

return 0;
}