#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
    string karakteri;
    getline(cin, karakteri);
    int a, b;
    cin >> a >> b;
    char c1 = karakteri.at(0);
    char c2 = karakteri.at(1);
    //cout << c1 << " " << c2 << " " << a << " " << b;
    int g = abs(a-b);
    if (g>1) {
        cout << "nemoguce" << endl;
        return 0;
    }
    if (a<b) {
        char ct = c1;
        c1 = c2;
        c2 = ct;
        int t = a;
        a = b;
        b = t;
    }
    for (int i = 0;i<a+b;i++) {
        if ((i==0)||(i%2==0)) {
            cout << c1;
        }
        else {
            cout << c2;
        }
    }

    return 0;
}