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

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            
            string s = Console.ReadLine();
            char c1 = s[0];
            char c2 = s[1];
            string t = Console.ReadLine();
            string[] t2 = t.Split(' ');
            int n1 = Convert.ToInt32(t2[0]);
            int n2 = Convert.ToInt32(t2[1]);
            if (Math.Abs(n1 - n2) > 1)
            {
                Console.WriteLine("nemoguce");
            }
            else
            {
                string s2="";
                int i = 0;
                if (n1 > n2)
                {
                    while (i < n2)
                    {
                        s2 += c1;
                        s2 += c2;
                        i++;
                    }
                    s2 += c1;
                    Console.WriteLine(s2);
                }
                else if (n2 > n1)
                {
                    while (i < n1)
                    {
                        s2 += c2;
                        s2 += c1;
                        i++;
                    }
                    s2 += c2;
                    Console.WriteLine(s2);
                }
                else
                {
                    while (i < n1)
                    {
                        s2 += c2;
                        s2 += c1;
                        i++;
                    }
                    Console.WriteLine(s2);
                }
            }
            
        }
    }
}