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

using namespace std;

int main(){
    char a,b;
    int x,y;
    a=getchar();
    b=getchar();
    cin >> x >> y;

    if(x<1 || x>50000 || y<1 || y>50000) exit(1);
    if(a==b || a<'a' || a>'z') exit(1);

    if(x==y){
        while (x>0){
            cout << a << b;
            x--;
        }
    }
    else if(abs(x-y)==1){
        if(x>y){
            while(x>1){
                cout << a << b;
                x--;
            }
            cout << a;
        }
        else{
            while(y>1){
                cout << b << a;
                y--;
            }
            cout <<b;
        }
    }
    else
        cout <<"nemoguce";
    return 0;
}