using System;

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