#include <iostream>
#include <cstdlib>
#include <climits>

using namespace std;
int main() {
  int a1,a2;
  char c[3];
  cout << "Unesite slova c1 i c2." << endl;
	cin >> c;
  cout << "Unesite komade slova c1 i c2." << endl;
    cin>> a1 >> a2; 
   
if(c[0] == c[1] || abs (a1 - a2 )> 1 ){
      cout <<"nemoguce\n";
    }else{
      if(a1 > a2){
        for (int i = 0; i < a1 + a2; i++) {
          char result = i % 2 == 0 ? c[0] : c[1];
          cout << result;
}
    }else{
      for (int i = 0; i < a1 + a2; i++) {
          char result = i % 2 == 0 ? c[1] : c[0];
          cout << result;
}
    }
      
    }

}