using System;
using System.Text;
using System.Diagnostics;

class cppboljiodcs
{

    static void Main()
    {
        string s = Console.ReadLine();
        char c1 = s[0];
        char c2 = s[1];

        string[] s2 = Console.ReadLine().Split();
        int a1 = int.Parse(s2[0]);
        int a2 = int.Parse(s2[1]);
        string dodatak = "";

        StringBuilder sb = new StringBuilder();
        if (Math.Abs(a1 - a2) > 1)
            Console.WriteLine("nemoguce");
        else
            if (a1 > a2)
        {
            dodatak += c1;
            dodatak += c2;
            for (int i = 0; i < a2; i++)
            {
                sb.Append(dodatak);
            }
            sb.Append(c1);
        }
        else if (a1 == a2)
        {
            dodatak += c1;
            dodatak += c2;
            for (int i = 0; i < a2; i++)
            {
                sb.Append(dodatak);
            }
        }
        else
        {
            dodatak += c2;
            dodatak += c1;
            for (int i = 0; i < a1; i++)
            {
                sb.Append(dodatak);
            }
            sb.Append(c2);
        }
        Console.WriteLine(sb);
    }
}