#include <iostream>
using namespace std;
int main()
{
    long int a1, a2, d;
    int i=1;
    char c1, c2, pom, kk;
    cin>>c1>>c2;
    cin>>a1>>a2;
    if((abs(a1-a2)>1)) || (a1 > 50000) || (a2 > 50000) || (a1 < 1) || (a2 <1) || (c1==c2))
{
    cout<<"nemoguce";
    return 0;
}
if(a1<a2)
{
    pom=c2;
    kk=c1;
    d=a1;
}
else
{ 
pom=c1;
kk=c2;
d=a2;
}
while(i<d+1)
{
    cout<<pom<<kk;
    i++;
    if(i==d+1 && a1!=a2)
    cout<<pom;
    break;
}
}
}