#include <iostream>
#include <cmath>
using namespace std;
int main() {
  int b1, b2, r, k, min;
  string str;
  char a1, a2;

  k = 0;
  cin >> str;
  cin >> b1 >> b2;

  a1 = str[0];
  a2 = str[1];
  r = b1 - b2;
  if (b1>b2) min = b2;
  else min = b1;

  if (r>1 || r<-1)
    cout << "nemoguce";
  else
  {
   if (r == -1) cout << a2;
   else;
   do
    {
     k++;
     cout << str;
    }
    while (k<min);
   if (r == 1) cout << a1;
   else;
  }
  return 0;
}