#include <cstdlib>
#include <bits/stdc++.h>
#include <ctime>

using namespace std;


int main () {

char charA, charB;
int numA, numB;

int pom = 0;

cin>>charA>>charB;
cin>>numA>>numB;

int sub = abs(numA - numB);

if ( sub > 1 || charA == charB) {
	cout<<"nemoguce";
}else {
	
	if ( numA == numB ) {
		for (int i = 0;i < numA;i++) {
			cout<<charA;
			cout<<charB;
		}
	}
	if( numA > numB ) {
		for (int i = 0;i < numA;i++) {
			cout<<charA;
			
			if(pom != numB) {
				cout<<charB;
			}
			pom++;
		}
	}
	if ( numB > numA ) {
		for (int i = 0;i < numB;i++) {
			cout<<charB;
			
			if(pom != numA) {
				cout<<charA;
			}
			pom++;
		}
	}
}


	
	
	return 0;
}