#include using namespace std; using ll = long long; // 部分列として "yiwiy" の出現数をカウント ll count_yiwiy(const string &s) { vector dp(6, 0); // dp[k]: 最初のk文字 "yiwiy"[0..k-1] を作る部分列数 string t = "yiwiy"; dp[0] = 1; for (char c : s) { for (int k = 4; k >= 0; k--) { if (c == t[k]) dp[k + 1] += dp[k]; } } return dp[5]; } // 部分列として "iwiwi" の出現数をカウント ll count_iwiwi(const string &s) { vector dp(6, 0); string t = "iwiwi"; dp[0] = 1; for (char c : s) { for (int k = 4; k >= 0; k--) { if (c == t[k]) dp[k + 1] += dp[k]; } } return dp[5]; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll Y, I, W, A, B; cin >> Y >> I >> W >> A >> B; vector candidates; // yiwiy優先配置 { string s = string(Y/2, 'y') + string(I/2, 'i') + string(W, 'w') + string(I - I/2, 'i') + string(Y - Y/2, 'y'); candidates.push_back(s); } // iwiwi優先配置 { string s = ""; int total = Y + I + W; for (int j = 0; j < total; j++) { if (I > 0) { s += 'i'; I--; } if (W > 0) { s += 'w'; W--; } } s += string(Y, 'y'); candidates.push_back(s); } ll best_val = -1; string best_s; for (auto &s : candidates) { ll val = A * count_yiwiy(s) + B * count_iwiwi(s); if (val > best_val) { best_val = val; best_s = s; } } cout << best_s << "\n"; }