#include <stdio.h>
#include <math.h>
int main()
{
    char c1, c2, n, m;
    int a1, a2, i;
    scanf("%c%c", &c1, &c2);
    scanf("%d%d", &a1, &a2);

    if (abs(a1 - a2) > 1 || c1 == c2)
        printf("nemoguce");
    else
    {
        if (a1 > a2)
        {
            for (n = c1, m = c2, i = 0; i < a2; i++)
                printf("%c%c", n, m);
            printf("%c", n);
        }
        else if (a2 > a1)
        {
            for (n = c2, m = c1, i = 0; i < a1; i++)
                printf("%c%c", n, m);
            printf("%c", n);
        }
        else
        {
            for (n = c2, m = c1, i = 0; i < a1; i++)
                printf("%c%c", n, m);
        }
    }
    return 0;
}