using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Nesusedni
{
    class Program
    {
        static void Zameni(ref string s1, ref string s2)
        {
            string p = s1;
            s1 = s2;
            s2 = p;
        }

        static string Rasporedi(string c1, string c2, int a1, int a2)
        {
            string s = "";

            for (int i = 0; i < a1; i++)
            {
                s += c1;
                s += c2;
                if (s[i] != c1[0])
                {
                    Zameni(ref c1, ref c2);
                }
                else
                {
                    return "nemoguce";

                }
            }

            return s;
        }
        static void Main(string[] args)
        {
            string s;
            s = Console.ReadLine();
            //char[] a = s.ToCharArray();

            while (s[0] == s[1] || char.IsUpper(s[0]) || char.IsUpper(s[1]))//u slucaju da su jednaki,ponovni unos
            {
                //Console.WriteLine("GRESKA");
                s = Console.ReadLine();
                //a = s.ToCharArray();
            }

            string c1 = s[0].ToString();
            string c2 = s[1].ToString();
            int a1, a2;
            string[] a1a2 = Console.ReadLine().Split();

            a1 = Convert.ToInt32(a1a2[0]);

            a2 = Convert.ToInt32(a1a2[1]);

            while (a1 <= 1 || a1 >= 50000 || a2 <= 1 || a2 >= 50000)
            {
                a1a2 = Console.ReadLine().Split();

                a1 = Convert.ToInt32(a1a2[0]);

                a2 = Convert.ToInt32(a1a2[1]);
            }

            Console.WriteLine(Rasporedi(c1, c2, a1, a2));

            Console.ReadKey();

        }
    }
}