#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;
char maximum(const vector<int>& vec){
   int high = 0;
   char c;
   for(int i = 0; i < 26; i++){
      if(vec[i] > high){
         high = vec[i];
         c = 'a' + i;
      }
   }
   return c;
}
string Rearrangement(string str, int length){
   int size = (length + 1) / 2;
   vector<int> vec(26, 0);
   string ptr(length, ' ');
   int temp = 0;
   for(auto it : str){
      vec[it - 'a']++;
   }
   char ch = maximum(vec);
   int total = vec[ch - 'a'];
   if(total > size){
      return "";
   }
   while(total){
      ptr[temp] = ch;
      temp = temp + 2;
      total--;
   }
   vec[ch - 'a'] = 0;
   for(int i = 0; i < 26; i++){
      while (vec[i] > 0){
         temp = (temp >= length) ? 1 : temp;
         ptr[temp] = 'a' + i;
         temp = temp + 2;
         vec[i]--;
      }
   }
   return ptr;
}
string ponovi(char prvi, char drugi,int a1, int a2)
{
    string s,s1,s2;
    s1.append(a1,prvi);
    s2.append(a2,drugi);
    s=s1+s2;
    return s;
}
int main(){
    string st1;
    for(int i =0; i<2;i++)
    cin >> st1[i];
    int a1,a2;
    cin >> a1 >> a2;
    char prvi = st1[0];
    char drugi = st1[1];
    if(prvi == drugi)
        cout << "nemoguce"<< endl;
   string str = ponovi(prvi,drugi,a1,a2);
   int length = str.length();
   string count = Rearrangement(str, length);
   if(a1 == a2+1 || a2==a1+1 || a1 == a2)
    cout<< count << endl;
   else
       cout<< "nemoguce" << endl;
   return 0;
}