#include <iostream>

int main()
{
    char c1, c2;
    long long int a1, a2;
    std::string String1, String2 = "";
    std::cin >> String1;
    c1 = String1[0];
    c2 = String1[1];
    std::cin >> a1 >> a2;
    if(a1 == a2)
    {
        for(int i=0; i<a1; i++)
        {
            String2 += c1;
            String2 += c2;
        }
        std::cout << String2;
    }
    else if(a1 == a2-1 || a2 == a1-1)
    {
        if(a1>a2)
            {
                for(int i=0; i<a2; i++)
                    {
                        String2 += c1;
                        String2 += c2;
                    }
                String2 += c1;
                std::cout << String2;
            }
        else
        {
            for(int i=0; i<a1; i++)
                    {
                        String2 += c2;
                        String2 += c1;
                    }
                String2 += c2;
                std::cout << String2;
        }

    }
    else std::cout << "nemoguce";
    return 0;
}