#include <bits/stdc++.h>

using namespace std;

int main(){
	string input;
	cin>>input;
	char slovo1 = input[0];
	char slovo2 = input[1];
	int a1,a2;
	cin>>a1>>a2;

	int razlika = abs(a1-a2);
	string rez = "";

	if(razlika == 1 || razlika == 0){
		if(a1>a2){
			for(int i = 0; i<a1+a2;i++){

				if(i%2==0){
					rez += slovo1;
				}else{
					rez += slovo2;
				}
			}
		}
		else{
			for(int i = 0; i<a1+a2;i++){
				
				if(i%2==0){
					rez += slovo2;
				}else{
					rez += slovo1;
				}
			}
		}
		cout<<rez<<endl;
	}
	else{
		cout<<"nemoguce"<<endl;
	}

}