#include <iostream>
#define forn(i, n) for (int i = 0; i < n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    char a = getchar(), b = getchar();
    int ac, bc;
    cin >> ac >> bc;
    if (a == b) cout << "nemoguce" << endl;
    else {
        if (ac == bc) {
            forn(i, ac) cout << a << b;
            cout << endl;
        } else if (ac == bc + 1) {
            cout << a;
            forn(i, bc) cout << b << a;
            cout << endl;
        } else if (bc == ac + 1) {
            cout << b;
            forn(i, ac) cout << a << b;
            cout << endl;
        } else {
            cout << "nemoguce" << endl;
        }
    }
}