#include <iostream>
#include <string>
using namespace std;

int main()
{
    string c1,c2;
    int a1,a2,i;
    getline(cin,c1);
    getline(cin, c2);
    cin>>a1;
    cin>>a2;
    if(a1==a2)
    {
        for(i=0;i<a1;i++)
            cout<<c1<<c2;
    }
    else if((a1+1)==a2)
   {
       cout<<c2;
       for(i=0;i<a1;i++)
        cout<<c1<<c2;
   }
   else if((a2+1)==a1)
   {
       cout<<c1;
       for(i=0;i<a2;i++)
        cout<<c2<<c1;
   }
   else
   {
       cout<<"nemoguce";
   }
    return 0;
}