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

int main()
{
    char c1, c2;
    cin >> c1 >> c2;
    int a, b;
    cin >> a >> b;
    if(max(a, b) > min(a, b) + 1){
        cout << "nemoguce\n";
        return 0;
    }

    if(a < b){
        swap(a, b);
        swap(c1, c2);
    }

    string res;
    int nx = 0;
    while(a > 0 || b > 0){
        if(nx == 0){
            res += c1;
            --a;
            nx = 1;
        }else{
            res += c2;
            --b;
            nx = 0;
        }
    }

    cout << res << "\n";
    return 0;
}