#include<iostream>
#include<string>
using namespace std;
int main(){
    long long a1, a2, k1, k2;
    char c1, c2;
    string n = "";
    cout<<"Unesite slova: "<<endl;
    cin>>c1>>c2;
    cout<<"Unesite broj tih slova: "<<endl;
    cin>>a1>>a2;
    if(abs(a1-a2)>1){
        cout<<"nemoguce"<<endl;
    }
    else if(a1==a2 || a1-a2==1){
        for(int i=1;i<=a1+a2;i++){
            if(i%2==1){
                n.push_back(c1);
            }
            else{
                n.push_back(c2);
            }
        }
        cout<<n<<endl;
    }
    else{
        for(int i=1;i<=a1+a2;i++){
            if(i%2==1){
                n.push_back(c2);
            }
            else{
                n.push_back(c1);
            }
        }
        cout<<n<<endl;
    }
    return 0;
}