#include <iostream>
using namespace std;
int main()
{
    struct slovo{
    char zn;
    int br;}p,q;
    char s[2],z[100];
    cin>>s[0]>>s[1];
    char a=s[0],b=s[1];
    int x,y;
    cin>>x>>y;
    if (x>y){
        p.zn=a;
        q.zn=b;
        p.br=x;
        q.br=y;
    }
    else{
        p.zn=b;
        q.zn=a;
        p.br=y;
        q.br=x;
    }
    if(p.br-q.br>1)
        cout<<"nemoguce";
    else
    for(int i=0;i<p.br+q.br;i++){
        if(i%2==0)
           z[i]=p.zn;
        else
           z[i]=q.zn;
        cout<<z[i];
    }


}