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

int main()
{
    string s;
    int a1, a2;
    char c1, c2;

    cin >> s;
    cin >> a1 >> a2;

    c1 = s[0];
    c2 = s[1];

    if(abs(a1 - a2) > 1) cout << "nemoguce" << endl;
    else
    {
        if(a1 == a2) {
            for(int i = 1; i <= a1; ++i) cout << c1 << c2;
        } else if(a1 > a2) {
            cout << c1;
            for(int i = 1; i <= a2; ++i) cout << c2 << c1;
        } else {
            cout << c2;
            for(int i = 1; i <= a1; ++i) cout << c1 << c2;
        }
    }

    return 0;
}