#include <bits/stdc++.h>

#define xx first
#define yy second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define mp make_pair
#define pb push_back
#define popb pop_back

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef string str;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAX=1e6+3;
int a, b;
char sa, sb;
string s, c;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> c >> a >> b;
    sa=c[0];
    sb=c[1];
    if(a>b+1 || b>a+1){
        cout << "nemoguce\n";
        return 0;
    }
    if(a==b) for(int i=0;i<a;i++) cout << sa << sb;
    if(a==b+1){
        for(int i=0;i<b;i++) cout << sa << sb;
        cout << sa;
        return 0;
    }
    if(b==a+1){
        for(int i=0;i<a;i++) cout << sb << sa;
        cout << sb;
        return 0;
    }

    return 0;
}