class Program
    {
        static void Main(string[] args)
        {
            string slova = Console.ReadLine();
            int b1 = 0;
            int b2 = 0;
            string[] komadi = Console.ReadLine().Split();
            string s = "";
            if(komadi.Length == 2)
            {
                b1 = Convert.ToInt32(komadi[0]);
                b2 = Convert.ToInt32(komadi[1]);
                if(b1 <= b2)
                {
                    slova = slova[1] +""+ slova[0];
                }
            }
            if(Math.Abs(b1 - b2) <= 1)
            {
                for(int i = 0; i < b1 + b2; i++)
                {
                    if(i % 2 == 0)
                    {
                        s += slova[0];
                    }
                    else
                    {
                        s += slova[1];
                    }
                }
            }
            else
            {
                s = "nemoguce";
            }
            Console.WriteLine(s);
        }
    }