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
#include <bits/stdc++.h>

using namespace std;

string num(long long n, string s){
    if(n==0) return "";
    if(n==1) return s;
    if(n<10){
        string res=" ";
        res[0]=n+'0';
        if(s.size()<=1) return res + s;
        return res+"["+s+"]";
    }
    return num(n%9, s) + num(9, num(n/9, s));
}


string triangle(long long n){
    if(n==1) return "CA";
    if(n==2) return "CACECAA";
    string res="";
    if(n&1){
        res+= "2[" + triangle(n/2) + "]";
        res+= "C" + num(n/2, "EC");
        res+= num(n/2, num(n/2, "EA") + "E" + num(n/2+1, "C")) + num(n, "A");
        return res;
    }
    res=triangle(n-1);
    res+= num(n-1, "CE") + "C" + num(n, "A");
    return res;
}



int main(){
    long long n;
    cin>>n;
    cout<<triangle(n);
    cout<< num(n, "E") <<endl;



}