#include <iostream>

using namespace std;

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