#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

const int mxN = 1e5+5;
const int mod = 1e9+7;
const int mxlogN = 20;
const int mxK = 52;

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

    string s; cin >> s;
    int n, m; cin >> n >> m;
    if(abs(n-m)>1) cout << "nemoguce\n";
    else
    {
        if(n<m) swap(s[0], s[1]);
        for(int i = 0; i < n+m; i++) cout << s[i%2];
        cout << "\n";
    }
}
/*
7 2 5 15 100
..##...
*/