#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    char c1, c2;
    int a, b;

    cin >> c1 >> c2 >> a >> b;
    //c1 = 'a'; c2 = 'b'; b = 50000; a = 49999;

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