#include <iostream>
#include <string>
using namespace std;

int main()
{
    char c1, c2;

    cin >> c1 >> c2;

    int a1, a2;

    cin >> a1 >> a2;

    string res;

    if(a1 == a2){

        for(int i = 0; i < a1 + a2; i = i +2){

            res.push_back(c1);

            res.push_back(c2);
        }

        cout << res;
    }

    else if(a1 + 1 == a2){

        res.push_back(c2);

        for(int j = 1; j < a1 + a2 - 1; j = j + 2){

            res.push_back(c1);

            res.push_back(c2);
        }

        cout << res;
    }

    else if(a2 + 1 == a1){

        res.push_back(c1);

        for(int h = 1; h < a1 + a2 - 1; h = h + 2){

            res.push_back(c2);

            res.push_back(c1);
        }

        cout << res;
    }

    else cout << "nemoguce";

}