using System;

class Program
{
    public static void Main(string[] args)
    {
        string c1c2 = Console.ReadLine();
        string[] s1 = Console.ReadLine().Split();
        int a1 = int.Parse(s1[0]);
        int a2 = int.Parse(s1[1]);
        if (a1 - a2 > 1 || a2 - a1 > 1)
        {
            Console.WriteLine("nemoguce");
        }
        else
        {
            Ispis(c1c2, a1, a2);
        }

    }
    static void Ispis(string c1c2, int a1, int a2)
    {
        int b = 0;
        if (a1 >= a2)
        {
            while (b < a2)
            {
                Console.Write(c1c2[0]);
                Console.Write(c1c2[1]);
                b ++;
            }
            if (a1 > a2)
            {
                Console.Write(c1c2[0]);
            }
        }
        else
        {
            while (b < a1)
            {
                Console.Write(c1c2[1]);
                Console.Write(c1c2[0]);
                b++;
            }
            Console.Write(c1c2[1]);
        }
    }
}