#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>

using namespace std;

int main(){
    char a,b;
    int x,y ,i=0;
    char s[a+b];
    a=getchar();
    b=getchar();
    cin >> x >> y;

    if(x-y==0){
        while (x>0){
            s[i] = a;
            s[i+1] = b;
            i+=2;
            x--;
        }
        cout << s;
    }
    else if(abs(x-y)==1){
        if(x>y){
            while(x>1){
                s[i] = a;
                s[i+1] = b;
                i+=2;
                x--;
            }
            s[i+1] = a;
            cout << s;
        }
        else{
            while(y>1){
                s[i] = b;
                s[i+1] = a;
                i+=2;
                x--;
            }
            s[i+1] = b;
            cout << s;
        }
    }
    else{
        cout << "nemoguce";
    }
    return 0;
}