#include <bits/stdc++.h>

using namespace std;

void solve(string s, int a1, int a2)
{
    char c1, c2;
    c1 = s[0];
    c2 = s[1];
    if (abs(a1 - a2) > 1)
    {
        cout << "nemoguce";
        return;
    }
    string solution[a1 + a2];
    if (a1 > a2)
    {
        /*for (int i = 0; i < a1 + a2; i += 2)
            solution[i] = c1;
        for (int i = 1; i < a1 + a2; i += 2)
            solution[i] = c2;*/
        for (int i = 0; i < a2; i++)
        {
            cout << c1 << c2;
        }
        cout << c1;
    }
    else
    {
        /*for (int i = 0; i < a1 + a2; i += 2)
            solution[i] = c2;
        for (int i = 1; i < a1 + a2; i += 2)
            solution[i] = c1;*/
        for (int i = 0; i < a1; i++)
        {
            cout << c2 << c1;
        }
        if (a1 != a2)
            cout << c1;
    }
    //cout << solution;
    return;
}

int main()
{
    string s;
    int a1, a2;
    cin >> s;
    cin >> a1 >> a2;
    solve(s, a1, a2);
    return 0;
}