using System;

namespace Nesusedni
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            char c1 = str[0];
            char c2 = str[1];
            string[] niz = Console.ReadLine().Split();
            int a1 = int.Parse(niz[0]);
            int a2 = int.Parse(niz[1]);
            string resenje = c1 + "" + c2;
            string s = "";
            string pomocni = c2 + "" + c1;
            string s1 = "";
            if(a1==a2)
            {
                for(int i = 0;i<a1;i++)
                {
                    s = s + resenje;
                }
                Console.WriteLine(s);
            }
            else if(a1 == a2+1)
            {
                for(int i = 0;i<a2;i++)
                {
                    s = s + resenje;
                }
                s = s + c1;
                Console.WriteLine(s);
            }
            else if (a2 == a1 + 1)
            {
                for (int i = 0; i < a1; i++)
                {
                    s1 = s1 + pomocni;
                }
                s1 = s1 + c2;
                s = s1;
                Console.WriteLine(s);
            }
            else
            {
                Console.WriteLine("nemoguce");
            }
        }
    }
}