using System;

namespace Takprog___slova
{
    class Program
    {
        static string Kombinacije(char c1, char c2, int b1, int b2)
        {
            string komb = "";
            if (b1 == b2)
            {
                for (int i = 0; i < b1; i++)
                { komb += c1; komb += c2; }
                return komb;
            }
            else if (b1 == b2 + 1)
            {
                komb += c1;
                for (int i = 0; i < b2; i++)
                { komb += c2; komb += c1; }
                return komb;
            }
            else if (b1 == b2 - 1)
            {
                komb += c2;
                for (int i = 0; i < b1; i++)
                { komb += c1; komb += c2; }
                return komb;
            }
            else return "nemoguce";
        }
        static void Main(string[] args)
        {
            string slova = Console.ReadLine();
            char s1 = slova[0];
            char s2 = slova[1];
            string[] brojevi = Console.ReadLine().Split();
            int b1 = Convert.ToInt32(brojevi[0]);
            int b2 = Convert.ToInt32(brojevi[1]);
            Console.WriteLine(Kombinacije(s1, s2, b1, b2));
        }
    }
}