#include <iostream>
#include <string>

using namespace std;

int main(){
	string s,r,a,b,c;
	int m,n,o;
	
	cin >> s;
	cin >> m >> n;
	
	a=s[0];
	b=s[1];
	
	c="";
	o=0;
	
	if (n>m){
		c=a;
		a=b;
		b=c;
		o=m;
		m=n;
		n=o;
	}
	
	if (m-n>1){
		cout << "nemoguce" << endl;
	}else{
		r="";
		while (n!=0){
			r=r+a;
			m--;
			r=r+b;
			n--;
		}
		if (m!=0){
			r=r+a;
		}
	}
	
	cout << r << endl;
}