#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dec(x, y) fixed << setprecision((y)) << (x)
#define xx first
#define yy second
#define srt(v) sort((v).begin(), (v).end())
#define srtr(v) sort((v).rbegin(), (v).rend())
#define pb push_back
#define popb pop_back
#define sz(a) (int)(a).size()
#define len(a) (int)(a).length()
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

char c1, c2;
int a1, a2;
int main() {
    ios;
    cin >> c1 >> c2;
    cin >> a1 >> a2;
    if(abs(a1-a2)>1) cout << "nemoguce";
    else if(a1>a2) {
        cout << c1;
        for(int i=0; i<a2; i++) cout << c2 << c1;
    }
    else {
        if(a2>a1) cout << c2;
        for(int i=0; i<a1; i++) cout << c1 << c2;
    }
    return 0;
}