#include <iostream>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
	char c1,c2;
	cin>>c1>>c2;
	int a1,a2;
	cin>>a1>>a2;
    char veci=(a1>a2)?c1:c2;
    char manji=(a1<a2)?c1:c2;
    if(a1==a2)
        for(int i=0;i<a1;i++)
            cout<<c1<<c2;
    else if(max(a1,a2)==min(a1,a2)+1){
        cout<<veci;
        for(int i=0;i<min(a1,a2);i++)
            cout<<manji<<veci;
    }
    else
        cout<<"nemoguce";
	return 0;
}