#include <iostream>
#include <cmath>
using namespace std;
int main() {
  int b1, b2, r, k, mk, mmin, m, min;
  string str, vstr;
  char a1, a2;
  
  mk = 0;
  k = 0;
  cin >> str;
  cin >> b1 >> b2;

  a1 = str[0];
  a2 = str[1];
  vstr = str + str + str + str + str +str + str + str;
  r = b1 - b2;
  if (b1>b2) min = b2;
  else min = b1;
  m = min % 8;
  mmin = min / 8;


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