#include <bits/stdc++.h>
using namespace std;
char c1, c2;
string s;
int a1, a2;
int main(){
    cin >> c1 >> c2 >> a1 >> a2;


    if(a1<a2){
        swap(a1, a2);
        swap(c1, c2);
    }


    if(a1-a2==0 or a1-a2==1){
        for(int i=0; i<a1+a2; i+=2){
            s.push_back(c1);
            s.push_back(c2);
        }
        if(s.size()>a1+a2){
            s.erase(a1+a2, 5);
        }
        cout << s << endl;
    }
    else{cout << "nemoguce" << endl;}
    return 0;
}