#include<bits/stdc++.h>

using namespace std;

int main()
{
    string input;
    int n, m;
    cin >> input;
    string a(1, input[0]);
    string b(1, input[1]);
    cin >> n >> m;
    string r = "";
    if(abs(n - m) >= 2)
    {
        cout << "nemoguce";
        return 0;
    }
    if(n > m)
    {
        for(int i=1;i<=n+m;++i)
        {
            if(i%2==0)
            {
                r += b;
                continue;
            }
            r += a;
        }
    }
    else
    {
        for(int i=1;i<=n+m;++i)
        {
            if(i%2==0)
            {
                r += a;
                continue;
            }
            r += b;
        }
    }
    cout << r << endl;

    return 0;
}