using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
using System.Numerics;
//using System.Data;
//using System.Drawing;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string u = Console.ReadLine();
            var s = Console.ReadLine().Split();
            int bs1 = int.Parse(s[0]);
            int bs2 = int.Parse(s[1]);
            if(Math.Abs(bs1-bs2)>1)
                Console.WriteLine("nemoguce");
            else
            {
                string prvichar = Convert.ToString(u[0]);
                string drugichar = Convert.ToString(u[1]);
                if (bs1>bs2)
                {
                    for (int i = 0; i < bs2; i++)
                        Console.Write(u);
                    Console.Write(prvichar);
                }
                else if(bs2>bs1)
                {
                    string obr = drugichar + prvichar;
                    for (int i = 0; i < bs1; i++)
                        Console.Write(obr);
                    Console.Write(drugichar);
                }
                else
                {
                    for (int i = 0; i < bs1; i++)
                        Console.Write(u);
                }
                Console.WriteLine();
            }
            
        }
    }
}