Problem:
Score : 1600 points

Problem Statement

For a string S, let f(S) be the lexicographically smallest cyclic shift of S.
For example, if S = babca, f(S) = ababc because this is the smallest among all cyclic shifts (babca, abcab, bcaba, cabab, ababc).

You are given three integers X, Y, and Z.
You want to construct a string T that consists of exactly X as, exactly Y bs, and exactly Z cs.
If there are multiple such strings, you want to choose one that maximizes f(T) lexicographically.

Compute the lexicographically largest possible value of f(T).

Constraints

1 \leq X + Y + Z \leq 50

X, Y, Z are non-negative integers.

Input

Input is given from Standard Input in the following format:

X Y Z

Output

Print the answer.

Sample Input 1

2 2 0

Sample Output 1

abab

T must consist of two as and two bs.

If T = aabb, f(T) = aabb.

If T = abab, f(T) = abab.

If T = abba, f(T) = aabb.

If T = baab, f(T) = aabb.

If T = baba, f(T) = abab.

If T = bbaa, f(T) = aabb.

Thus, the largest possible f(T) is abab.

Sample Input 2

1 1 1

Sample Output 2

acb

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

// Copyright (C) 2017 Sayutin Dmitry.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.

#include <iostream>
#include <vector>
#include <stdint.h>
#include <algorithm>
#include <set>
#include <map>
#include <array>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <string>
#include <assert.h>
#include <iterator>
#include <cstdint>
#include <cinttypes>
#include <string.h>
#include <random>
#include <numeric>
#include <tuple>


using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::min;
using std::abs;
using std::max;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define pb push_back
#define eb emplace_back

// solve problem when a != 0.
string solve(int a, int b, int c) {
    string base = "a";
    
    while (c >= a)
        base += 'c', c -= a;
    while (b >= a)
        base += 'b', b -= a;

    if (b == 0 and c == 0) {
        string res = "";
        for (int t = 0; t != a; ++t)
            res += base;
        return res;
    }
    
    int num = (a + (b + c - 1)) / (b + c);
    int free = num * (b + c) - a;

    string tmp = "";
    for (int i = 0; i != num - 1; ++i)
        tmp += base;
        
    vector<string> parts;
    for (int i = 0; i != (b + c - free); ++i)
        parts.push_back(tmp + base);

    for (int i = 0; i != free; ++i)
        parts.push_back(tmp);
        
    for (int i = 0; i != c; ++i)
        parts[i] += 'c';
    for (int i = 0; i != b; ++i)
        parts[c + i] += 'b';

    std::sort(ALL(parts));
    vector<string> cparts = parts;
    cparts.resize(std::unique(ALL(cparts)) - cparts.begin());

    while (cparts.size() < 3)
        cparts.push_back("");

    assert(SZ(cparts) == 3);
    string zzans = solve(std::count(ALL(parts), cparts[0]),
                         std::count(ALL(parts), cparts[1]),
                         std::count(ALL(parts), cparts[2]));

    string ans = "";
    for (char ch: zzans)
        ans += cparts[ch - 'a'];

    return ans;
}

int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    // code here.
    int a = input<int>();
    int b = input<int>();
    int c = input<int>();

    std::map<char, char> back;
    if (a == 0 and b == 0) {
        back['a'] = 'c';
        a = c;
        b = 0;
        c = 0;
    } else if (a == 0) {
        back['a'] = 'b';
        back['b'] = 'c';
        a = b;
        b = c;
        c = 0;
    } else {
        back['a'] = 'a';
        back['b'] = 'b';
        back['c'] = 'c';
    }

    // solve problem when a != 0.
    string ans = solve(a, b, c);
    for (int i = 0; i != SZ(ans); ++i)
        cout << back[ans[i]];
    cout << "\n";
    
    return 0;
}