#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    string c;
    int a1, a2;
    cin >> c;
    cin >> a1 >> a2;
    string c1;
    string c2;
    c1=c[0];
    c2=c[1];
    if (abs(a1-a2)>1){
        cout << "nemoguce" << endl;
    }
    else if (a1==a2 || a1==a2+1){
        for (int i=0; i<(a1+a2); i++){
            if (i%2==0){
                cout<<c1;
            }
            else{cout<<c2;}
        }
    }
    else{
        for (int i=0; i<(a1+a2); i++){
            if (i%2==0){
                cout<<c2;
            }
            else{cout<<c1;}
        }
    }
    return 0;
}