#include <iostream>
#include <string>

using namespace std;

int main()
{
    int a1,a2,placeholder;
    char slovo;
    string slova,c1,c2,rec="";
    cin >> slova ;
    cin >> a1 >> a2;
    if(a1<a2){
        placeholder=a1;
        a1=a2;
        a2=placeholder;
        slovo=slova[1];
        slova[1]=slova[0];
        slova[0]=slovo;
    }
    if(a1-a2==1){
        for(int i=0;i<a2;i++){
            rec+=slova;
        }
        cout << rec << slova[0] << endl;
    }
    else if(a1-a2==0){
        for(int i=0;i<a2;i++){
            rec+=slova;
        }
        cout << rec << endl;;
    }
    else{
        cout << "nemoguce" << endl;
    }
    return 0;
}