#include <iostream>

using namespace std;

int main()
{
    char c1, c2;
    int a1, a2;
    cin >> c1 >> c2;
    cin >> a1 >> a2;
    if(c1 == c2)
        return 0;
    if(a1<1 || a1>50000 || a2<1 || a2 >50000)
        return 0;
    if(a2==a1){
        for(int i=0; i<a1; i++)
            cout << c1 << c2;
    }
    else if(a2==a1+1){
        for(int i=0; i<a1; i++)
            cout << c2 << c1;
        cout << c2;
    }
    else if(a2==a1-1){
        for(int i=0; i<a2; i++)
            cout << c1 << c2;
        cout << c1;
    }
    else
        cout << "nemoguce";
    return 0;
}