#include <bits/stdc++.h>
using namespace std;

int main()
{
    string s; cin >> s;
    char a = s[0];
    char b = s[1];

    int a1, b1; cin >> a1 >> b1;

    if (abs(a1 - b1) > 1) { cout << "nemoguce"; return 0; }

    if (a1 == b1) { for (int i = 0; i < a1; i++) cout << a << b; return 0; }
    if (a1 > b1) { cout << a; for (int i = 0; i < b1; i++) cout << b << a; return 0; }
    if (b1 > a1) { cout << b; for (int i = 0; i < a1; i++) cout << a << b; return 0; }
}