#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    char c1, c2;
    char c[3];
    int a1, a2;

    gets(c);

    c1 = c[0];
    c2 = c[1];

    if(c1==c2)
    {
        printf("Uneta su dva ista slova!");
        return 0;
    }

    scanf("%d %d", &a1, &a2);

    if(a1<1 || a2 > 50000)
    {
        printf("Unete su nevalidne vrednosti za a1 i/ili a2!");
        return 0;
    }

    if(a1>a2)
    {
        if(a1-a2 > 1)
        {
            printf("nemoguce");
        }
        else if(a1-a2 == 1)
        {
            char rec[a1+a2+1];
            int i=0;
            for(i=0;i<a1+a2-1;i+=2)
            {
                rec[i] = c1;
                rec[i+1] = c2;
            }
            rec[i] = c1;
            printf(rec);
        }
    }
    else if(a2>a1)
    {
        if(a2-a1>1)
        {
            printf("nemoguce");
        }
        else if(a2-a1 == 1)
        {
            char rec[a2+a1+1];
            int i=0;
            for(i=0;i<a2+a1-1;i+=2)
            {
                rec[i] = c2;
                rec[i+1] = c1;
            }
            rec[i] = c2;
            printf(rec);
        }
    }
    else
    {
        char rec[a1+a2+1];
        for(int i=0;i<a1+a2;i+=2)
        {
            rec[i] = c1;
            rec[i+1] = c2;
        }
        printf(rec);
    }

    return 0;
}