#include <iostream>
#include <string.h>
#include <cmath>
#include <stdio.h>
using namespace std;
int main()
{
    char c1, c2;
    int a1, a2;
    cin >> c1 >> c2;
    cin >> a1 >> a2;
    if(c1==c2)
        cout << "nemoguce";
    else if(abs(a1-a2)==1 || abs(a1-a2)==0)
    {
        char resenje[a1+a2];
        char *p;
        p=resenje;
        *p = '\0';
        int i = 1;
        int n = a1+a2;
        if(a1>=a2)
        {
            resenje[0]=c1;
            a1--;
        }
        else {
                resenje[0]=c2;
                a2--;
        }
        while(i<=n)
        {
            if(resenje[i-1]==c1 && a2>0)
            {
                resenje[i]=c2;
                a2--;
            }
            else if(resenje[i-1]==c2 && a1>0)
            {
                resenje[i]=c1;
                a1--;
            }
            i++;
        }
        resenje[i-1]='\0';
        puts(resenje);
    }
    else cout << "nemoguce";
    return 0;
}