#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin>>s;
    int n, m;
    cin>>n>>m;

    char c1 = s[0];
    char c2 = s[1];

    if(n == m) for(int i = 0; i < n; i++) cout<<c1<<c2;
    else if(n == m+1)
    {
        for(int i = 0; i < m; i++) cout<<c1<<c2;
        cout<<c1;
    }
    else if(m == n+1)
    {
        for(int i = 0; i < n; i++) cout<<c2<<c1;
        cout<<c2;
    }
    else cout<<"nemoguce";

}