#include <iostream>
#include <cmath>

using namespace std;

int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    char a;
    cin >> a;
    char b;
    cin >> b;

    int n1, n2;
    cin >> n1 >> n2;

    if(n2 >= n1)
    {
        swap(n1, n2);
        swap(a, b);
    }

    if(abs(n1 - n2) == 0)
    {
        for(int i = 0; i < n2; i++)
        {
            cout << a << b;
        }
    }
    else if(abs(n1 - n2) == 1)
    {
        for(int i = 0; i < n2; i++)
        {
            cout << a << b;
        }
        cout << a;    
    }
    else
    {
        cout << "nemoguce";
    }   

    return 0;
}