#include <bits/stdc++.h>
using namespace std;
int a1,a2;
string s,rez;
int main(){
cin >> s;
cin >> a1 >> a2;
char c1 = s[0];
char c2 = s[1];
if(a1==a2){
    for(int i=0;i<(a1+a2)/2;i++){
        rez.push_back(c1);
        rez.push_back(c2);
    }
    cout << rez << endl;
}
if(a1==a2+1 or a2==a1+1){
    for(int i=0;i<(a1+a2)/2;i++){
        rez.push_back(c1);
        rez.push_back(c2);
    }
    if(a1==a2+1){
        rez.push_back(c1);
    }
    else if(a2==a1+1){
        rez.push_back(c1);
    }
    cout << rez << endl;
}
    else cout << "nemoguce" << endl;
return 0;
}