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

namespace Nesusedni
{
    class Program
    {
        struct Karakter
        {
            public char c;
            public int a;
        }
        static void Razmeni(ref Karakter a, ref Karakter b)
        {
            Karakter p = a;
            a = b;
            b = p;
        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] st = Console.ReadLine().Split();
            Karakter k1 = new Karakter();
            Karakter k2 = new Karakter();
            k1.c = s[0];
            k2.c = s[1];
            k1.a = int.Parse(st[0]);
            k2.a = int.Parse(st[1]);
            StringBuilder sb = new StringBuilder();
            if (k1.a < k2.a)
                Razmeni(ref k1, ref k2);
            if (k1.a - k2.a > 1)
                Console.WriteLine("nemoguce");
            else
            {
                for (int i = 0; i < k1.a + k2.a; i++)
                {
                    if (i % 2 == 0)
                        sb.Append(k1.c);
                    else
                        sb.Append(k2.c);
                }
                Console.WriteLine(sb);
            }
        }
    }
}