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

namespace _A__Nesusedni
{
    class Program
    {
        static void Ulaz(ref char c1, ref char c2, ref int a1, ref int a2)
        {
            string s = Console.ReadLine();

            c1 = s[0];
            c2 = s[1];

            var ulaz = Console.ReadLine().Split();

            a1 = int.Parse(ulaz[0]);
            a2 = int.Parse(ulaz[1]);
        }
        static bool Moguce(int a1, int a2)
        {
            return Math.Abs(a1 - a2) < 2 ? true : false;
        }
        static string FormirajString(char c1, char c2, int a1, int a2)
        {
            string s = "", x = "";
            
            if (a1 >= a2) 
            {
                x = x + c1 + c2;

                s = string.Concat(Enumerable.Repeat(x, (a1 + a2) / 2));

                if (a1>a2)
                {
                    s = s + c1;
                }
            }
            else 
            {
                x = x + c2 + c1;

                s = string.Concat(Enumerable.Repeat(x, (a1 + a2) / 2));

                s = s + c2;
            }
            return s;
        }

        static void Main(string[] args)
        {
            char c1 = ' ', c2 = ' ';
            int a1 = 0, a2 = 0;

            Ulaz(ref c1, ref c2, ref a1, ref a2);

            if (Moguce(a1, a2))
            {
                Console.WriteLine(FormirajString(c1, c2, a1, a2));
            }
            else
            {
                Console.WriteLine("nemoguce");
            }
        }
    }
}