#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    string c12;
    cin >> c12;
    char c1=c12[0], c2=c12[1];
    int a1, a2;
    cin >> a1;
    cin >> a2;
    string rec = "", novaRec = "";
    for (int i = 0; i < a1; i++) {
        rec += c1;
    }
    for (int i = 0; i < a2; i++) {
        rec += c2;
    }
    char recSlova[rec.length()+1];
    strcpy(recSlova, rec.c_str());
    for (int i = 0; i < rec.length(); i++) {
        int j = i;
        while (j > 0 && j < rec.length() - 1 && (recSlova[j + 1] == recSlova[j] || recSlova[j - 1] == recSlova[j])) {
            char t = recSlova[j];
            recSlova[j] = recSlova[j - 1];
            recSlova[j - 1] = t;
            j--;
        }
        if (recSlova[1] == recSlova[0]) {
            char t = recSlova[0];
            recSlova[0] = recSlova[rec.length() - 1];
            recSlova[rec.length() - 1] = t;
        }
    }
    int br = 0;
    for (int i = 0; i < rec.length(); i++) {
        if (i > 0 && i < rec.length() - 1 && (recSlova[i + 1] == recSlova[i] || recSlova[i - 1] == recSlova[i])) {
            br++;
        }
        if (recSlova[1] == recSlova[0]) {
            br++;
        }
    }
    for (int i = 0; i < rec.length(); i++) {
        novaRec += recSlova[i];
    }
    if (br > 0) {
        cout << "nemoguce";
    } else {
        cout << novaRec;
    }
}