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

namespace Piramida
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] s1 = Console.ReadLine().Split();

            int x = int.Parse(s1[0]);
            int y = int.Parse(s1[1]);
            char[] c = s.ToCharArray();

            if (x == y)
            {
                string k = null;
                for (int i = 0; i < y; i++)
                {
                    k += s;
                }
                Console.WriteLine(k);
            }

            else if (y == x - 1)
            {
                string k = null;
                for (int i = 0; i < y; i++)
                {
                    k += s;
                }
                Console.WriteLine(k + c[0]);
            }

            else if (x == y - 1)
            {
                string k = null;
                for (int i = 0; i < x; i++)
                {
                    k = k + c[1] + c[0];
                }
                Console.WriteLine(k + c[1]);
            }

            else
            {
                Console.WriteLine("nemoguce");
            }
        }
    }
}