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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string p = Console.ReadLine();
            string[] a = Console.ReadLine().Split();
            int i = 0;
            string[] j = new string[2];
            foreach(char c in p)
            {
                j[i] = c.ToString();
                i++;
            }
            string c1 = j[0];
            string c2 = j[1];
            int a1 = int.Parse(a[0]);
            int a2 = int.Parse(a[1]);

            if(Math.Abs(a1-a2)>1)
            {
                Console.WriteLine("nemoguce");
            }
            else
            {
                string s;
                if(a1>a2)
                {
                    int r = 1;
                    s = "";
                    while(a1>=r)
                    {
                        s += c1 + c2;
                        r++;
                    }
                    s += c1;
                }
                else
                {
                    if(a2>a1)
                    {
                        int q = 1;
                        s = "";
                        while (a2 >= q)
                        {
                            s += c2 + c1;
                            q++;
                        }
                        s += c2;
                    }
                    else
                    {
                        s = "";
                        int w = 1;
                        while (a1 >= w)
                        {
                            s += c1 + c2;
                            w++;
                        }
                    }
                }
                Console.WriteLine(s);
            }
        }
    }
}