1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
using namespace std;

ll n;
vector<string> wynik;

string lls(ll a, string s){
	vector<int> rr;
	string ww = "";
	while(a){
		rr.push_back(a % 9);
		a /= 9;
	}
	for(int i = 0; i < rr.size(); i++){
		if(rr[i] != 0){
			ww = ww + (char)('0' + rr[i]) + "[" + s + "]";
		}
		if(i != rr.size() - 1)
			ww += "9[";
	}
	for(int i = 1; i < rr.size(); i++)
		ww += "]";
	return ww;
}


void rysuj(ll lp){
	if(lp == 1){
		wynik.push_back("A");
	}
	else if(lp == 2)
		wynik.push_back("AEACA");
	else if(lp == 3)
		wynik.push_back("AEAEACACECAA");
	else if(lp % 2 == 1){
		ll lp2 = lp / 2;
		string s1 = lls(lp2 + 1, "A");
		string s2 = lls(lp2, "EC");
		wynik.push_back(lls((lp2), s1 + s2 + "E"));
		wynik.push_back(lls(lp2, "AE") + "A");
		wynik.push_back("2[");
		wynik.push_back(lls(lp2, "C"));
		rysuj(lp2);
		wynik.push_back("]");
	}else{
		wynik.push_back(lls(lp - 1, "AE") + "A");
		wynik.push_back(lls(lp - 1, "C"));
		rysuj(lp - 1);
	}
}

int main(){
	cin >> n;
	wynik.push_back(lls(n, "C"));
	rysuj(n);
	wynik.push_back(lls(n, "E"));
	for(auto e : wynik)
		cout << e;
	cout << "\n";
}