#include <iostream>
#include <vector>

using namespace std;

int main(){

    char c1, c2;
    int a1, a2;
    
    cin>>c1>>c2>>a1>>a2;
    const int zbir = a1+a2;
    vector<char> niz {};

    if(a1>a2+1||a2>a1+1){
            cout<<"nemoguce";
            return 0;
    }
    
    if(a1>=a2){
        for(int i = 0; i<=zbir; i++){
            if(a2==0){
                if(a1!=0){
                    niz.push_back(c1);
                    break;
                }else
                    break;
            }
            niz.push_back(c1);
            a1--;
            niz.push_back(c2);
            a2--;
            
        }   
    }else{
        for(int i = 0; i<=zbir; i++){
            if(a1==0){
                niz.push_back(c2);
                break;
            }
            niz.push_back(c2);
            a2--;
            niz.push_back(c1);
            a1--;
        }
    }
    
    for(int j=0; j<niz.size(); j++){
        cout<<niz[j];
    }

    return 0;
}