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: Accepted)

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int C[1100];
int B[1100];
int ad=0;
vector<string> str;
void f(string aa,string bb,string cc,int a,int b,int c){
	//printf("%s %s %s %d %d %d\n",aa.c_str(),bb.c_str(),cc.c_str(),a,b,c);
	if(a==0){
		f(bb,cc,"",b,c,0);
		return;
	}
	if(b+c==0){
		for(int i=0;i<a;i++)printf("%s",aa.c_str());printf("\n");return;
	}
	ad=0;
	for(int i=0;i<1100;i++)B[i]=C[i]=0;
	while(a==0){
		a=b;b=c;c=0;ad++;
	}
	for(int i=0;i<c;i++){
		C[i%a]++;
	}
	if(C[0]!=C[a-1]){
		int f=0;
		for(int i=0;i<a;i++)if(C[a-1]==C[i])f++;
		for(int i=0;i<b;i++){
			B[a-f+i%f]++;
		}
	}else{
		for(int i=0;i<b;i++){
			B[i%a]++;
		}
	}
	str.clear();
	for(int i=a-1;i>=0;i--){
		string tmp="";
		tmp+=aa;
		for(int j=0;j<C[i];j++)tmp+=cc;//printf("%c",'c'+ad);
		for(int j=0;j<B[i];j++)tmp+=bb;//printf("%c",'b'+ad);
		str.push_back(tmp);
	}
	std::sort(str.begin(),str.end());
//	for(int i=0;i<str.size();i++)printf("%s\n",str[i].c_str());
	string ta="",tb="",tc="";
	int va=0;
	int vb=0;
	int vc=0;
	int fi=0;
	int ph=0;
	for(int i=0;i<a;i++){
		if(str[i]==str[fi]){
			if(ph==0){va++;ta=str[i];}
			if(ph==1){vb++;tb=str[i];}
			if(ph==2){vc++;tc=str[i];}
		}else{
		//	printf("%s %s\n",str[i].c_str(),str[fi].c_str());
			if(ph==0){ph++;vb++;tb=str[i];fi=i;}
			else if(ph==1){ph++;vc++;tc=str[i];fi=i;}
			
		}
	}
	f(ta,tb,tc,va,vb,vc);
}
int main(){
	
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	f("a","b","c",a,b,c);
	
	
	/*for(int i=0;i<100;i++){
		int a=rand()%10;
		int b=rand()%10;
		int c=rand()%10;
		if(a+b+c==0)continue;
		printf("%d %d %d: ",a,b,c);
		f("a","b","c",a,b,c);
	}*/
}