using System;

namespace kvalifikacije1._1
{
    class Program
    {
        static string sklopiString(int n1, int n2, char c1, char c2)
        {
            string str = "";
            for (int i = 1; i < n1; i++)
            {
                str += c1;
                str += c2;
            }
            return str;
        }
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] spl = Console.ReadLine().Split();
            int n1 = int.Parse(spl[0]);
            int n2 = int.Parse(spl[1]);
            char c1 = str[0];
            char c2 = str[1];
            if (Math.Abs(n2 - n1) > 1) Console.WriteLine("nemoguce");
            else
            {
                string nstr = "";
                if (n1 > n2)
                {
                    nstr = sklopiString(n1, n2, c1, c2);
                    nstr += c1;
                }
                if (n2 > n1)
                {
                    nstr = sklopiString(n2, n1, c2, c1);
                    nstr += c2;
                }
                if(n2==n1)
                {
                    nstr = sklopiString(n1, n2, c1, c2);
                    nstr += c1;
                    nstr += c2;
                }
                Console.WriteLine(nstr);
            }
        }
    }
}