#include <bits/stdc++.h>
using namespace std;
string s;
int a,b;
int main(){
    cin >> s >> a >> b;

    if( a == b ) {
        for( int i=1;i<=a;i++ ){
            cout << s ;
        }
        cout <<endl;
    }
    else if( a-b == 1 ) {
        for( int i=1;i<=b;i++ ){
            cout << s ;
        }
        cout << s[0] <<endl;
    }
    else if( b-a == 1 ) {
        reverse(s.begin(),s.end());
        for( int i=1;i<=a;i++ ){
            cout << s ;
        }
        cout << s[0] <<endl;
    }
    else if( abs(a-b) > 1 ) cout << "nemoguce" <<endl;

return 0;
}