#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char c1, c2;
    cin >> c1 >> c2;
    unsigned short int a1, a2;
    cin >> a1 >> a2;
    if (abs(a1 - a2) >= 2) {
        cout << "nemoguce";
    }
    else {
        string resenje = "";
        if (a1 > a2) {
            for (unsigned short int i = 0; i < a2; i++)
            {
                resenje = resenje + c1 + c2;
            }
            resenje = resenje + c1;
        }
        else if (a1 < a2) {
            for (unsigned short int i = 0; i < a1; i++)
            {
                resenje = resenje + c2 + c1;
            }
            resenje = resenje + c2;
        }
        else {
            for (unsigned short int i = 0; i < a2; i++)
            {
                resenje = resenje + c1 + c2;
            }
        }
        cout << resenje;
    }
}