#include <bits/stdc++.h>
using namespace std;
int a1,a2;
char c1,c2;
int main()
{
    cin>>c1>>c2>>a1>>a2;
    if(abs(a1-a2)<=1){
        if(a1>a2){
            for(int i=1; i<=a2; i++){
                cout<<c1<<c2;
            }
            cout<<c1<<endl;
        }
        else if(a2>a1){
            for(int i=1; i<=a1; i++){
                cout<<c2<<c1;
            }
            cout<<c2<<endl;
        }
        else{
            for(int i=1; i<=a2; i++){
                cout<<c1<<c2;
            }
            cout<<endl;
        }
    }
    else cout<<"nemoguce"<<endl;
    return 0;
}