#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

string resi(string c, char c1, char c2, ll a1, ll a2) {
    string s = "";
    if (a1 > a2) {
        for(int i = 0;i < a2;i++)
            s += c;
        s += c1;
    }
    else if (a1 < a2) {
        reverse(c.begin(), c.end());
        for(int i = 0;i < a1;i++)
            s += c;
        s += c2;
    }
    else {
        for(int i = 0;i < a1;i++)
            s += c;
    }
    return s;
}

int main () {
    string c;
    char c1, c2;
    ll a1, a2;
    cin >> c;
    c1 = c[0];
    c2 = c[1];
    cin >> a1 >> a2;
    if (abs(a1 - a2) > 1)
        cout << "nemoguce";
    else
        cout << resi(c, c1, c2, a1, a2);
    //cout << c1 << " " << c2;
    return 0;
}