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

int main() {
    string letters;
    int a1, a2;
    cin >> letters >> a1 >> a2;
    char c1 = letters[0];
    char c2 = letters[1];
    
    if( abs(a1-a2) < 2 ) {
        int i = 0;
        switch (a1-a2) {
            case 0:
                while(i < a1) {
                    cout << c1 << c2;
                    i++;
                }
            break;
            case 1:
                while(i < a2) {
                    cout << c1 << c2;
                    i++;
                }
                cout << c1;
            break;
            case -1:
                while(i < a1) {
                    cout << c2 << c1;
                    i++;
                }
                cout << c2;
            break;
        }
        
    } else
        cout << "nemoguce";
        
    return 0;
}