#include <bits/stdc++.h>

int main() {

    char c1,c2;
    scanf(" %c%c",&c1,&c2);
    int a,b;
    scanf("%d%d",&a,&b);

    if(abs(a-b)>1) {printf("nemoguce\n");return 0;}
    char pc = (a>=b) ? c1 : c2;
    char dc = c1+c2-pc;
    //char* rez = (char*)malloc(a+b+1);
    //memset(rez,pc,a+b+1);
    char rez[a+b+1];
    //char pc = (a>=b) ? c1 : c2;
    //char dc = c1+c2-pc;

    for (int i=0; i<a+b; i+=2) rez[i] = pc;
    for (int i=1; i<a+b; i+=2) rez[i] = dc;

    rez[a+b] = '\0';
    //puts(rez);
    printf("%s\n", rez);


}