#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    char c1 = s[0];
    char c2 = s[1];
    int a1,a2;
    cin>>a1>>a2;
    if(a1==a2){
        while(a1--){cout<<c1<<c2;}
        cout<<endl;
    }
    else if(a1+1==a2){
        while(a1--){cout<<c2<<c1;}
        cout<<c2<<endl;
    }
    else if(a1==a2+1){
        while(a2--){cout<<c1<<c2;}
        cout<<c1<<endl;
    }
    else{
        cout<<"nemoguce"<<endl;
    }
    return 0;
}