#include <iostream>

using namespace std;

int main() {
    char c1, c2;
    int a1, a2;
    cin >> c1 >> c2;
    cin >> a1 >> a2;

    char slova[2] = { c1, c2 };
    int zbir = a1 + a2;

    if (abs(a1 - a2) >= 2)
        cout << "nemoguce" << endl;
    else if (abs(a1 - a2) == 1) {
        int i = (a1 > a2 ? 0 : 1);
        while (zbir > 0) {
            cout << slova[i];
            zbir--;
            i ^= 1;
        }
    } else {
        int i = 0;
        while (zbir > 0) {
            cout << slova[i];
            zbir--;
            i ^= 1;
        }
    }
}