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

int main()
{
    int a, b, c;
    char a1, b1;
    string a2, s1 = "";
    cin>>a2;
    a1 = a2[0];
    b1 = a2[1];
    cin>>a>>b;
    if(abs(a - b) >= 2){
        cout<<"nemoguce";
    }else{
        if(a > b){
        for(int i = 0; i < a + b; i+=2){
            s1.push_back(a1);
            s1.push_back(b1);
        }
        }else{
          for(int i = 0; i < a + b; i+=2){
            s1.push_back(b1);
            s1.push_back(a1);
          }
        }
    }
    cout<<s1;
    return 0;
}