using System;

namespace Takmicenja
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 1;
            string c = Console.ReadLine();
            string[] a = Console.ReadLine().Split();
            char x = c[0];
            char y = c[1];
            int x1 = int.Parse(a[0]);
            int y1 = int.Parse(a[1]);
            int v = x1 + y1;
            string[] m = new string[x1 + y1];
            if (Math.Max(x1, y1) - Math.Min(x1, y1) > 1)
            {
                Console.WriteLine("nemoguce");
                return;
            }
            if (x1 > y1)
            {
                m[0] = x.ToString();
                x1--;
            }
            else
            {
                m[0] = y.ToString();
                y1--;
            }
            while (x1 != 0 || y1 != 0)
            {
                if (m[i - 1] == x.ToString())
                {
                    m[i]= y.ToString();
                    y1--;
                }
                else
                {
                    m[i] = x.ToString();
                    x1--;
                }
                i++;
            }
            for (i = 0; i < v; i++)
            {
                Console.Write(m[i]);
            }
        }
    }
}