#include <iostream>
#include<math.h>
using namespace std;

int main()
{
    bool moguce = true;
    char c1,c2;
    int a1,a2;
    string rec;
    cin >> c1>>c2;
    cin >> a1>>a2;
    int veci;
    if(abs(a1-a2)>1){
        cout<<"nemoguce"<<endl;
        moguce = false;
    }else{
        if(a1>a2){
            veci = a1;
        }else{
            veci = a2;
        }
        for(int i = 0; i<(a1+a2); i++){
            if(veci == a1){
                if(i%2 == 0){
                    rec += c1;
                }else{
                    rec += c2;
                }
            }else if(veci == a2){
                if(i%2 == 0){
                    rec += c2;
                }else{
                    rec += c1;
                }
            }
        }
    }
    if(moguce){
        cout<<rec<<endl;
    }
    return 0;
}