#include <bits/stdc++.h>

using namespace std;

int main(){
	string s;getline(cin, s);
	long long pera, petra;cin >> pera >> petra;
	if(pera == petra){
		for(long long i = 0;i < pera;i++){
			cout << s[0] << s[1];
		}
		cout << endl;
	}
	else if(pera - petra == 1){
        for(long long  i = 0;i < pera;i++){
            if(i == pera - 1){
                cout << s[0];
            }
            else{
                cout << s[0] << s[1];
            }
		}
	}
	else if(petra - pera == 1){
        for(long long i = 0;i < petra;i++){
            if(i == petra - 1){
                cout << s[1];
            }
            else{
                cout << s[1] << s[0];
            }
		}
	}
	else{
		cout << "nemoguce" << endl;
	}
	return 0;
}