#include <iostream>
#include <cstdlib>

int main() {
    char c1, c2;
    int n1, n2;


    // input
    std::cin >> c1 >> c2;
    std::cin >> n1 >> n2;


    // resiti
    if(abs(n1-n2)==1 || abs(n1-n2)==0) {
        if(n1==n2) {
            for(int i=0;i<n1;i++)
                std::cout << c1 << c2;
        } else {
            char veci_char = n1>n2 ? c1 : c2;
            char manji_char = n1<n2 ? c1 : c2;
            int manji = n1<n2 ? n1 : n2;
            
            for(int i=0;i<manji;i++) {
                std::cout << veci_char << manji_char;
            }

            std::cout << veci_char;
        }
    } else
        // slucaj kada je nemoguce
        printf("nemoguce");
}