#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    string s;
    cin >> s;
    int a, b;
    cin >> a >> b;
    if(abs(a - b) > 1){
        cout << "nemoguce\n";
        return 0;
    }
    if(b > a) swap(a, b), swap(s[0], s[1]);
    while(a > 0 || b > 0){
        if(a) cout << s[0], a--;
        if(b) cout << s[1], b--;
    }
    return 0;
}