#include <iostream>

using namespace std;

int main()
{
    char c1,c2,b1,b2;
    int a1=0,a2=0,n=0,m=0,p=0,k=0;
    cin>>c1>>c2;
    cin>>a1>>a2;
    if(a1>=a2)
    {
        n=a1;
        m=a2;
        b1=c1;
        b2=c2;
    }
    if(a1<a2)
    {
        n=a2;
        m=a1;
        b1=c2;
        b2=c1;
    }
    p=n-m;
    do
    {

      k=k+1;
      if(p>1)
      {
        cout<<"nemoguce";
        break;
      }

      if(k<=n)
      {
          cout<<b1;
      }
      if(k<=m)
      {
          cout<<b2;
      }
    }
    while(k<=n);


   return 0;
}