#include <iostream>
using namespace std;

int main(){
  char c1, c2;
  int n, m;
  int i;

  cin>>c1>>c2;
  cin>>n>>m;

  if (n - m == 1){
    for(i = 0; i < m; i++) {
      cout<<c1<<c2;
    }

    cout<<c1;
  }

  else if (m - n == 1) {
    for(i = 0; i < n; i++) {
      cout<<c2<<c1;
    }

    cout<<c2;
  }

  else if (n == m){
    for(i = 0; i < n; i++) {
      cout<<c2<<c1;
    }
  }

  else cout << "nemoguce";
  return 0;
}