using System;

namespace ConsoleApp25
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            char a = s[0];
            char b = s[1];
            
            string[] o1 = Console.ReadLine().Split(' ');
            int c = int.Parse(o1[0]);
            int d = int.Parse(o1[1]);

            if (Math.Abs(c - d) > 1 || a == b)
                Console.WriteLine("nemoguce");
            else if (c > d)
            {
                for (int i = 0; i < d; i++)
                    Console.Write(s);
                Console.Write(a);
            }
            else if (c < d)
            {
                char p = a;
                a = p;
                b = p;
                for (int i = 0; i < c; i++)
                    Console.Write(s);
                Console.Write(b);
            }
            else
            {
                for (int i = 0; i < c; i++)
                    Console.Write(s);
            }


        }
    }
}