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

using namespace std;

void print (char c1, char c2, int n, int m) {
  if (n == m) 
    for (int i = 0; i < n; i++)
      cout << c1 << c2;
  else if (n == m + 1) {
    for (int i = 0; i < m; i++)
      cout << c1 << c2;
    cout << c1;
  }
  else {
    for (int i = 0; i < n; i++)
      cout << c2 << c1;
      cout << c2;
  }
    
    
}

int main() {
  string input;
  cin >> input;
  int n,m;
  cin >> n >> m;
  char c1,c2;
  c1 = input[0];
  c2 = input[1];

  if (n == m || n == m + 1 || m == n + 1) {
    print(c1, c2, n, m);
  }
  else cout << "nemoguce";

}