using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string unos = Console.ReadLine();
            char c1 = unos[0];
            char c2 = unos[1];
            string[] nizStr = Console.ReadLine().Split();
            int a1 = Convert.ToInt32(nizStr[0]);
            int a2 = Convert.ToInt32(nizStr[1]);

            if (Math.Abs(a1 - a2) > 1)
            {
                Console.WriteLine("nemoguce");
                return;
            }
            int i = 0;
            if (a1 == a2)
            {
                while (i < a1)
                {
                    Console.Write(c1 + "" + c2);
                    i++;
                }
            }
            else if (a1 > a2)
            {
                while (i < a2)
                {
                    Console.Write(c1 + "" + c2);
                    i++;
                }
                Console.Write(c1);
            }
            else
            {
                while (i < a1)
                {
                    Console.Write(c2 + "" + c1);
                    i++;
                }
                Console.Write(c2);
            }
        }
    }
}