#include <bits/stdc++.h>
#include <time.h>
using namespace std;

#define sz(x) ((int)(x).size())
#define pb push_back
#define vec vector
#define fi first
#define se second
#define ends "\n"
#define sp ' '
#define fun function
#define ar(x) array<int, x>
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const long long MOD=1e9+7; 

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if(sizeof...(t)) cerr << ", "; DBG(t...); }
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)



int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr);
 	  
    string s;
    cin >> s;
    int x1, x2;
    cin >> x1 >> x2;
    char c1 = s[0], c2 = s[1];

 	if(abs(x1 - x2) > 1)
        cout << "nemoguce" << ends;
    else{
        if(x1 < x2){
            swap(x1, x2);
            swap(c1, c2);
        }
        string ans = "";
        bool turn = true;

        for(int i = 0; i < x1 + x2; ++i){
            if(i % 2){
                ans += c2;
            }else
                ans += c1;
        }

        cout << ans << ends;
    }
}