#include <bits/stdc++.h>
using namespace std;

#define ll long long
const int N = 200001;
const int inf = 1e9 + 7;
int a[N], b[N];

void solve() {
    char n, x, y, z;
    int n1, n2;
    cin >> x >> y;
    cin >> n1 >> n2;
    if (abs(n1 - n2) > 1 || x == y) {
        cout << "nemoguce" << endl;
        return;
    }
    for (int i = 0; i < n1 + n2; i++) {
        if (i % 2 == 0) {
            if (n1 > n2)
                cout << x;
            else
                cout << y;
        }
        else {
            if (n1 > n2)
                cout << y;
            else
                cout << x;
        }
    }
    cout << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}