#include <bits/stdc++.h>
using namespace std;
int a,b,g;
string s,s1,s2;
int main () {
    cin>>s>>a>>b;
    if(abs(a-b)<=1){
        g=min(a,b);
        if(a>b){
            cout<<s[0];
            s1=s;
            s[0]=s1[1];
            s[1]=s1[0];
        }
        else if(b>a){cout<<s[1];}
        for(int i=1;i<=g;i++){
            cout<<s;
        }
    }
    else cout<<"nemoguce"<<endl;
    return 0;
}