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

namespace Petlja
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] s = new char[2];
            string k = Console.ReadLine();
            int i1 = 0;
            foreach (char g in k)
            {
                s[i1] = g;
                i1++;
            };
            char c1 = s[0];
            char c2 = s[1];
            string[] k1 = Console.ReadLine().Split();
            int a1 = int.Parse(k1[0]);
            int a2 = int.Parse(k1[1]);
            int n = a1 + a2;
            int p = 0;
            if (Math.Max(a1, a2) - Math.Min(a1, a2) == 1 || a1 == a2)
            {
                while(a1+a2>0)
                { 
                    if (a1>a2)
                    {
                        Console.Write(c1);
                        a1--;
                        p = 1;
                    }
                    else if(a2>a1)
                    {
                        Console.Write(c2);
                        a2--;
                        p = 2;
                    }
                    else
                    {
                        if (p == 1)
                        {
                            Console.Write(c2);
                            a2--;
                        }
                        else if (p == 2)
                        {
                            Console.Write(c1);
                            a1--;
                        }
                        else
                        {
                            Console.Write(c1);
                            a1--;
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("nemoguce");
            }

        }
    }
}