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

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    string slova;
    ll a1,a2;
    cin >> slova;
    cin >> a1 >> a2;
    if (abs(a1-a2)>1)
    {
        cout << "nemoguce\n";
        return 0;
    }
    if (a1==a2)
    {
        for (ll i=1;i<=a1+a2;i++)
        {
            if (i%2!=0)
                cout << slova[0];
            else
                cout << slova[1];
        }
        cout << "\n";
        return 0;
    }
    if (a1>a2)
    {
        for (ll i=1;i<=a1+a2;i++)
        {
            if (i%2!=0)
                cout << slova[0];
            else
                cout << slova[1];
        }
        cout << "\n";
        return 0;
    }
    for (ll i=1;i<=a1+a2;i++)
    {
        if (i%2!=0)
            cout << slova[1];
        else
            cout << slova[0];
    }
    cout << "\n";
    return 0;
}