#include <iostream>
using namespace std;
int main() 
{
  char c1,c2;
  long int a1,a2;
  scanf("%c%c", &c1, &c2);
  scanf("%ld%ld", &a1,&a2);
  if(c1==c2) printf("nemoguce");
  else
  {
    char cmax,cmin;
    long int amax,amin;
    cmax=(a1>a2)?c1:c2;
    cmin=(a1>a2)?c2:c1;
    amax=(a1>a2)?a1:a2;
    amin=(a1>a2)?a2:a1;
    if(amax-amin>1) printf("nemoguce");
    else
      for(long int i=0;i<amax+amin;i++)
      {
        if(i%2==0) printf("%c", cmax);
        else printf("%c", cmin);
      }
  }
}