#include <stdio.h>

int main()
{
    char c1, c2;
    int a1, a2;

    scanf("%c%c", &c1, &c2);
    scanf("%d %d", &a1, &a2);

    int yandare = 0;

    if(c1 == c2 || !(1<=a1 && 1<=a2) || !(a1<=50000 && a2<=50000))
    {
        printf("nemoguce");
        return 0;
    }
    else
    {
        const int arr_size = a1+a2;
        char str_arr_1[arr_size];
        char str_arr_2[arr_size];
        int amnt_left1 = a1;
        int amnt_left2 = a2;

        for(int i = 0; i < arr_size; i++)
        {
            if(yandare == 0)
            {
                if(amnt_left1 >= 1)
                {
                    str_arr_1[i] = c1;
                }
                else
                {
                    str_arr_1[i] = c2;
                }
                amnt_left1--;
                yandare = 1;
            }
            else
            {
                if(amnt_left2 >= 1)
                {
                    str_arr_1[i] = c2;
                }
                else
                {
                    str_arr_1[i] = c1;
                }
                amnt_left2--;
                yandare = 0;
            }
        }
        amnt_left1 = a1;
        amnt_left2 = a2;
        yandare = 0;
        for(int i = 0; i < arr_size; i++)
        {
            if(yandare == 0)
            {
                if(amnt_left2 >= 1)
                {
                    str_arr_2[i] = c2;
                }
                else
                {
                    str_arr_2[i] = c1;
                }
                amnt_left2--;
                yandare = 1;
            }
            else
            {
                if(amnt_left1 >= 1)
                {
                    str_arr_2[i] = c1;
                }
                else
                {
                    str_arr_2[i] = c2;
                }
                amnt_left1--;
                yandare = 0;
            }
        }

        int correct_str = 0;
        for(int i = 1; i < arr_size; i++)
        {
            if(str_arr_1[i] == str_arr_1[i-1])
            {
                correct_str = 0;
                break;
            }
            else
            {
                correct_str = 1;
            }
        }
        if(correct_str == 0)
        {
            for(int i = 1; i < arr_size; i++)
            {
                if(str_arr_2[i] == str_arr_2[i-1])
                {
                    correct_str = 0;
                    break;
                }
                else
                {
                    correct_str = 2;
                }
            }
        }

        switch(correct_str)
        {
            case 0:
                printf("nemoguce\n");
                break;
            case 1:
                for(int i = 0; i < arr_size; i++)
                {
                    printf("%c", str_arr_1[i]);
                }
                break;
            case 2:
                for(int i = 0; i < arr_size; i++)
                {
                    printf("%c", str_arr_2[i]);
                }
                break;
        }
    }
    return 0;
}