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

int main()
{
    string slova;
    cin >> slova;
    long long a, b;
    cin >> a >> b;
    char a1, b1;
    long long a2, b2;
    if (a >= b)
    {
        a1 = slova[0];
        a2 = a;
        b1 = slova[1];
        b2 = b;
    }
    else
    {
        a2 = b;
        b1 = slova[0];
        a1 = slova[1];
        b2 = a;
    }

    if (a == b || (max(a, b) - min(a, b)) == 1)
    {
        while ((a2 + b2) != 0)
        {
            if (a2 != 0)
            {
                cout << a1;
                a2--;
            }
            if (b2 != 0)
            {
                cout << b1;
                b2--;
            }
        }
    }
    else
    {
        cout << "nemoguce" << endl;
    }

    return 0;
}