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;
            if (Math.Max(a1, a2) - Math.Min(a1, a2) == 1 || a1 == a2)
            {
                for (int i = 0; i < n; i++)
                {
                    if (a1>a2)
                    {
                        Console.Write(c1);
                        a1--;
                    }
                    else
                    {
                        Console.Write(c2);
                        a2--;
                    }
                }
            }
            else
            {
                Console.WriteLine("nemoguce");
            }

        }
    }
}