#include <iostream>
#include <string>

using namespace std;

const unsigned int MAX_BROJ=50000;
const unsigned int MIN_BROJ=1;

int main()
{
    char c1, c2;
    int a1, a2, n=0;
    int i=0;
    string s;
    cin >> c1 >> c2;
    cin >> a1 >> a2;
    n=a1-a2;
    if(n!=0 && n!=1 && n!=-1)
        n=2;
    if (islower(c1) && islower(c2) && a1<=MAX_BROJ && a1>=MIN_BROJ && a2<=MAX_BROJ && a2>=MIN_BROJ && c1!=c2)
    {
        switch(n)
        {
        case 0:
            while(i<a1)
            {
                s.push_back(c1);
                s.push_back(c2);
                i++;
            }
            cout << s;
            break;
        case 1:
            while(i<a2)
            {
                s.push_back(c1);
                s.push_back(c2);
                i++;
            }
            s.push_back(c1);
            cout << s;
            break;
        case -1:
            while(i<a1)
            {
                s.push_back(c2);
                s.push_back(c1);
                i++;
            }
            s.push_back(c2);
            cout << s;
            break;
        case 2:
            cout << "nemoguce";
            break;
        }
    }
    else
        cout << "nemoguce";
    return 0;
}