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

#define endl '\n'
#define ll long long
#define NMAX (int)1e6
#define vi vector<int>
#define pii pair<int,int>
#define w(x) cout<<#x<<':'<<x<<endl;
#define PB push_back
#define juseinbolt ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

bool getVerdict(string ans, string input, int a1, int a2)
{
    map<char,int> cnt;
    for(int i=0; i+1<ans.size(); ++i)
    {
        cnt[ans[i]]++;
        if(ans[i]==ans[i+1]) return false;
    }
    cnt[ans[ans.size()-1]]++;
    if(a1!=cnt[input[0]]) return false;
    if(a2!=cnt[input[1]]) return false;
    return true;
}


int main()
{
    juseinbolt;

    char c1,c2; int a1,a2;
    string ans, input;
    cin>>c1>>c2>>a1>>a2;
    if(abs(a1-a2)>=2) cout<<"nemoguce";
    else{
        if(a1<a2)
        {
            swap(a1,a2); swap(c1,c2);
        }
        input="aa";
        input[0]=c1; input[1]=c2;
        for(int i=0; i<a2; ++i) ans+=input;
        if(a1!=a2) ans+=c1;
    }
    cout<<ans;
    /*cout<<endl;
    if(getVerdict(ans,input,a1,a2)) cout<<"OK";
    else cout<<"WA";*/
    return 0;
}