using System.Text;
string x =Console.ReadLine();
string n =Console.ReadLine();
int n1 = 0;
int n2 = 0;
n1 = Convert.ToInt32(n.Substring(0, 1));
n2 = Convert.ToInt32(n.Substring(2, 1));
StringBuilder sb=new StringBuilder();
string c1 = x.Substring(0, 1);
string c2 = x.Substring(1, 1);
if ((n1 >= 1 && n1 <= 50000) && (n2 >= 1 && n2 <= 50000) && (c1 != c2))
{
    if (Math.Abs(n1 - n2) > 1)
        Console.WriteLine("nemoguce");
    else if (n1 > n2)
    {
        for (int i = 0; i < n2; i++)
            sb.Append(c1 + c2);
        sb.Append(c1);
    }
    else if (n2 > n1)
    {
        for (int i = 0; i < n1; i++)
            sb.Append(c2 + c1);
        sb.Append(c2);
    }
    else
    {
        for (int i = 0; i < n1; i++)
            sb.Append(c2 + c1);
    }
    Console.WriteLine(sb);
}
else
    Console.WriteLine("nemoguce");