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

namespace Nesusedni
{
    class Program
    {
        static void Main(string[] args)
        {
            string resenje = "";
            string str = Console.ReadLine();
            string c1 = str[0].ToString();
            string c2 = str[1].ToString();
            string[] m = Console.ReadLine().Split();
            int a1 = int.Parse(m[0]);
            int a2 = int.Parse(m[1]);
            int r = Math.Abs(a1 - a2);
            if (r >= 2) Console.WriteLine("nemoguce");
            else if (r == 1) 
            {
                if (a1 > a2) 
                {
                    for (int i = 0; i < a2; i++)
                    {
                        resenje = resenje + c1 + c2;
                    }
                    resenje += c1;
                }
                else
                {
                    for (int i = 0; i < a1; i++)
                    {
                        resenje = resenje + c2 + c1;
                    }
                    resenje += c2;
                }
                Console.WriteLine(resenje);
            }
            else
            {
                for (int i = 0; i < a2; i++)
                {
                    resenje = resenje + c1 + c2;
                }
                Console.WriteLine(resenje);
            }
        }
    }
}