using System;

namespace Slova
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Convert.ToString(Console.ReadLine());
            string c1 = Convert.ToString(s[0]);
            string c2 = Convert.ToString(s[1]);
            string[] ss = Console.ReadLine().Split();
            int a1 = Convert.ToInt32(ss[0]);
            int a2 = Convert.ToInt32(ss[1]);
            string sss = "";
            if (c1==c2 || Math.Abs(a1-a2)>=2)
            {
                Console.WriteLine("nemoguce");
            }
            else
            {
                if (a1>a2)
                {
                    bool ok = true;
                    while (a1>0)
                    {
                        if (ok==true)
                        {
                            sss += c1;
                            a1--;
                            ok = false;
                        }
                        if (ok == false)
                        {
                            if (a2==0)
                            {
                                continue;
                            }
                            a2--;
                            sss += c2;
                            ok = true;
                        }
                    }
                }
                else
                {
                    bool ok = true;
                    while (a2 > 0)
                    {
                        if (ok == true)
                        {
                            sss += c2;
                            a2--;
                            ok = false;
                        }
                        if (ok == false)
                        {
                            if (a1 == 0)
                            {
                                continue;
                            }
                            a1--;
                            sss += c1;
                            ok = true;
                        }
                    }
                }
            }
            Console.WriteLine(sss);
        }
    }
}