#include <bits/stdc++.h>

using namespace std;

#define MAX 300000

int main()
{
    char c,a;
    char s[MAX];
    long long int n,m;
    for(int i = 0; i < 2; ++i)
    {
        cin >> s[i];
    }
    c = s[0];
    a = s[1];
    cin >> n >> m;
    if(m >= n+2 || n >= m+2)
    {
        cout << "nemoguce" << endl;
        return 0;
    }
    else
    {
        if(m == n)
        {
            for(long long int i = 0; i < m; ++i)
            {
                for(long long int j = 0; j < 2; ++j)
                {
                    cout << s[j];
                }
            }
        }
        else if(n == m+1)
        {
            for(long long int i = 0; i < m; ++i)
            {
                for(long long int j = 0; j < 2; ++j)
                {
                    cout << s[j];
                }
            }
            cout << c;
        }
        else if(m == n+1)
        {
            char temp = s[0];
            s[0] = s[1];
            s[1] = temp;
            for(long long int i = 0; i < n; ++i)
            {
                for(long long int j = 0; j < 2; ++j)
                {
                    cout << s[j];
                }
            }
            cout << a;
        }
    }
    return 0;
}