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
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <bits/stdc++.h>
#include <stdlib.h>

using namespace std;

long long n;

string multiply2k(string a, long long k){
    string beginS = "";
    string endS = "";
    while(k >= 3){
        beginS = beginS + "8[";
        endS += "]";
        k -= 3;
    }
    if(k == 1){
        beginS = beginS + "2[";
        endS += "]";
    }else if(k == 2){
        beginS = beginS + "4[";
        endS += "]";
    }
    return beginS + a + endS;
}

string multiply(string a, long long k){
    if(k == 7) return ""+a+""+"6["+a+"]";
    if(k == 15) return ""+a+""+"7[2["+a+"]]";
    if(k == 31) return ""+a+""+"5[6["+a+"]]";
    if(k == 63) return "7["+a+"]"+"7[2[8["+a+"]]";
    if(k == 127) return ""+a+""+"7[9[6["+a+"]]]";
    if(k == 255) return "5["+a+"]"+"5[5[5[2["+a+"]]]]";
    if(k == 511) return "7["+a+"]"+"7[2[6[6["+a+"]]]]";
    if(k == 1023) return "5[9["+a+"]]"+"7[4[6[6["+a+"]]]]";
    if(k == 2047) return "5[5[9[9[9["+a+"]]]]]"+"7[7[7[4["+a+"]]]]";
    if(k == 4095) return "7[5[5["+a+"]]]"+"7[7[5[4[8["+a+"]]]]";
    if(k == 8191) return ""+a+""+"7[7[7[9[9["+a+"]]]]]"+"7[9[9[9[9[9[9["+a+"]]]]]]]";
    if(k == 16383) return "7["+a+"]"+"5[5[5[4["+a+"]]]]"+"7[7[9[9[6[6["+a+"]]]]]]";
    if(k == 32767) return "7[7[7[5[5["+a+"]]]]]"+"7[4[8[6[6[6["+a+"]]]]]";
    if(k == 65535) return "7[7[5[9["+a+"]]]]"+"5[5[2[6[6[6[6["+a+"]]]]]]]";
    if(k == 131071) return ""+a+""+"7[7[5[6["+a+"]]]]"+"5[5[4[6[6[6[6["+a+"]]]]]]]";
    if(k == 262143) return "7[7[7[5[5[9[9[9["+a+"]]]]]]]]"+"7[9[9[9[9[9[9[6["+a+"]]]]]]]]";
    if(k == 524287) return ""+a+""+"7[7[7[5[5[9[9[6["+a+"]]]]]]]]"+"7[9[9[9[9[9[6[6["+a+"]]]]]]]]";
    if(k == 1048575) return "7[7[7[7[7[7[7["+a+"]]]]]]]"+"5[5[5[5[5[2[6[6["+a+"]]]]]]]]"+"2[4[8["+a+"]]";
    if(k == 2097151) return "7["+a+"]"+"7[7[7[5[5[6[6[6["+a+"]]]]]]]]"+"7[9[9[9[6[6[6[6["+a+"]]]]]]]]";
    if(k == 4194303) return "7[7[7[7[7[7[7["+a+"]]]]]]]"+"5[5[5[5[5[5[5[5[2[8["+a+"]]]]]]]]]"+"5[2[4[8[4[8[4[8[6["+a+"]]]]]]";
    if(k == 8388607) return "7[7[7[7[7["+a+"]]]]]"+"7[7[7[7[5[5[2[6[6["+a+"]]]]]]]]]"+"5[5[5[5[5[6[6[6[6["+a+"]]]]]]]]]";
    if(k == 16777215) return "7[7[7[7[7[7[7[5["+a+"]]]]]]]]"+"7[7[5[5[9[9[9[6[6["+a+"]]]]]]]]]"+"7[5[5[4[8[4[8[4[8[4[8["+a+"]]]]]]]";
    if(k == 33554431) return "7[7[5[5[5[5[5[9["+a+"]]]]]]]]"+"5[5[5[5[5[5[6[6[6[6["+a+"]]]]]]]]]]"+"7[7[4[4[8[4[8[4[8[4[8["+a+"]]]]]]]";
    if(k == 67108863) return "7[7[7[5[5[5[5[5[5[9[9["+a+"]]]]]]]]]]]"+"5[4[6["+a+"]]]"+"2[8[4[8[4[8[4[8[4[8[6[6["+a+"]]]]]]]";
    if(k == 134217727LL) return "7[5[5[5[5[5[5["+a+"]]]]]]]"+"7[7[7[5[9[6[6["+a+"]]]]]]]"+"7[9[9[9[9[9[9[9[9[9[9[9[9[6[6["+a+"]]]]]]]]]]]]]]]";
    if(k == 268435455LL) return "7[7[7[7[7[5[5[5[5[5[5["+a+"]]]]]]]]]]]"+"5[5[5[5[2[4[8["+a+"]]]]]]"+"7[5[2[8[4[8[6[6[6[6["+a+"]]]]]]]]";
    if(k == 1073741823LL) return "7[7[7[7[7[7[7[7[7[9[9["+a+"]]]]]]]]]]]"+"7[7[7[7[5[2[4[8[6[6["+a+"]]]]]]]]]"+"7[5[5[2[4[8[4[8[6[6[6[6[6["+a+"]]]]]]]]]]]";
    if(k == 2147483647LL) return "7[7[7[7[7[7[5[5[9[9[9[9[9[9["+a+"]]]]]]]]]]]]]]"+"5[5[9[9[9[9[9[6["+a+"]]]]]]]]"+"7[7[7[7[7[7[7[4["+a+"]]]]]]]]";
    if(k == 4294967295LL) return "7[7[7[5[5[9["+a+"]]]]]]"+"7[7[7[7[7[7[5[5[9[9[9[9[9[6["+a+"]]]]]]]]]]]]]]"+"5[4[4[8[4[8[6[6[6[6["+a+"]]]]]]]]";
    if(k == 8589934591LL) return "7[7[7[7[7[5[5[9[9[9[9[9[9[9[9["+a+"]]]]]]]]]]]]]]]"+"7[5[5[5[5[4[8["+a+"]]]]]]"+"7[7[7[9[9[9[9[9[9[9[6[6[6[6[6["+a+"]]]]]]]]]]]]]]]";
    string res = "";
    long long pow = 0;
    while(k){
        if(k%2){
            res += multiply2k(a,pow);
        }
        pow++;
        k/=2;
    }
    return res;
}



string lka(int k, bool dir){ 
    k--;
    string p1, p2, p3, res;
    if(dir){
        p1 = "AC";
        p2 = "A";
        p3 = "E";
    }else{
        p1 = "DB";
        p2 = "D";
        p3 = "F";
    }
    if(k == -1) return p2;
    string lin1 = multiply(p1,(1LL<<k)-1) + p2 + multiply(p3, 1LL<<k);
    string lin2 = multiply(p1,(1LL<<(k+1))-1) + p2;
    string lin3 =  multiply(p3, 1LL<<(k+1));
    res = multiply(lin1, 1LL<<k) + multiply(lin2 + lin3, (1LL<<k) - 1) + lin2;
    return res;
}

string trian2k(int k){
    string res = "E";
    int s = 0;
    for(int i = 0; i<k; i++){
        //cout<<i<<" * "<<(1<<(k-i))-1<<"\n";
        res += multiply(lka(i,i%2),(1LL<<(k-i))-1);
        if(i%2) res += multiply("E" ,1LL<<(i));
        else res += multiply("F" ,1LL<<(i));
    }
    for(int i = k-1; i>0; i--){
        if(i%2) {
            res += multiply("C" ,1LL<<(i));
            string lin = multiply("B" ,1LL<<(i-1)) + multiply("F" ,1LL<<(i-1));
            res += multiply(lin, ((1LL<<(k-i)) - 1LL)*2LL );
        }
        else {
            res += multiply("B" ,1LL<<(i));
            string lin = multiply("C" ,1LL<<(i-1)) + multiply("E" ,1<<(i-1));
            res += multiply(lin, ((1LL<<(k-i)) - 1)*2LL);
        }
    }
    res += "B";
    res += multiply("CE",(1LL<<(k))-1);
    res += "C";
    res += multiply("A",(1LL<<(k)));
    return res;

}

string trian(long long k){
    if(k == 0)return "";
    if(k == 1)return "DFB";
    if(k == 2)return "DDFFBCEAB";
    string res = "";
    long long p = 0LL;
    while((1LL<<(p+1)) <= k)p++;
    long long len = (1LL<<(p));
    if(len == k)return trian2k(p);
    res += multiply("D",len);
    res += trian(k - len);
    string lin1 = multiply("FB",len-1) + "F";
    string lin2 = multiply("D", len);
    res += multiply(lin1 + lin2, k-len-1);
    res += lin1;
    res += trian2k(p);
    res += multiply("B",k-len);
    return res;
}

int main(){
    cin>>n;
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cout<<trian(n);
    return 0;
}