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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#include <bits/stdc++.h>

#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define st first
#define nd second

using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vll = vector<ll>;

map<ll, pii> smooth_dist;
ll n;

void Preproc() {
	vll smooth_nums{1};
	for (int p : {2, 3, 5, 7}) {
		vll old_set;
		swap(old_set, smooth_nums);
		
		for (ll elem : old_set) {
			while (elem <= n) {
				smooth_nums.push_back(elem);
				elem *= p;
			}
		}
	}
	
	sort(ALL(smooth_nums));
	smooth_dist[1] = pii{0, -1};
	for (int i = 1; i < SZ(smooth_nums); ++i) {
		const ll val = smooth_nums[i];
		int dist = 1e9;
		int who_best = -1;
		for (int mult = 2; mult <= 9; ++mult) {
			if (val % mult == 0) {
				const int cand = smooth_dist[val / mult].first + 1;
				if (cand < dist) {
					dist = cand;
					who_best = mult;
				}
			}
		}
		smooth_dist[val] = pii{dist, who_best};
	}
}

string Repeat(string what, ll cnt) {
	if (cnt == 0 || what.empty()) { return ""; }
	if (cnt == 1) { return what; }
	if (cnt <= 9) {
		string s = to_string(cnt);
		if (SZ(what) != 1) { s += "["; }
		s += what;
		if (SZ(what) != 1) { s += "]"; }
		return s;
	}
	
	string what_repeat = Repeat(what, cnt / 9);
	string ans;
	if (SZ(what_repeat) == 1) {
		ans = "9" + what_repeat;
	} else {
		ans = "9[" + what_repeat + "]";
	}
	ans += Repeat(what, cnt % 9);
	return ans;
}

string RepeatFunny(string what, ll cnt) {
	if (cnt == 0) { return ""; }
	if (cnt == 1) { return what; }

	auto prev_smooth = prev(smooth_dist.upper_bound(cnt));
	const ll smooth_val = prev_smooth->first;
	vi factoring;
	{
		ll smooth_copy = smooth_val;
		while (smooth_copy != 1) {
			const int p = smooth_dist[smooth_copy].second;
			factoring.push_back(p);
			smooth_copy /= p;
		}
	}
	debug() << imie(smooth_val) << imie(factoring);
	
	string s;
	for (int val : factoring) {
		s += to_string(val) + "[";
	}
	s += what;
	for (int i = 0; i < SZ(factoring); ++i) {
		s += "]";
	}
	s += RepeatFunny(what, cnt - smooth_val);
	
	const string t = Repeat(what, cnt);
	
	if (SZ(s) < SZ(t)) {
		return s;
	} else {
		return t;
	}
}

string QuadDCA(ll n) {
	string ans = Repeat("C", n) + "A" + Repeat("EA", n);
	return RepeatFunny(ans, n);
}

string FullTri(ll n);
string TriE(ll n);

string FullTri(ll n) {
	if (n == 0) {
		return "";
	} else if (n == 1) {
		return "DFB";
	} else if (n % 2 == 0) {
		string ans = Repeat(TriE(n / 2), 2);
		ans += Repeat("C", n / 2);
		ans += QuadDCA(n / 2);
		ans += Repeat("C", n / 2);
		ans += Repeat("A", n / 2);
		return ans;
	} else {
		string ans = "D";
		ans += FullTri(n - 1);
		ans += Repeat("FD", n - 1);
		ans += "F";
		ans += Repeat("B", n);
		return ans;
	}
}

string TriE(ll n) {
	if (n == 1) {
		return "E";
	} else {
		string ans = "E";
		ans += FullTri(n - 2);
		ans += Repeat("CE", n - 1);
		ans += Repeat("AE", n - 1);
		return ans;
	}
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);
	
	
	cin >> n;
	Preproc();
	cout << FullTri(n) << "\n";
	//~ cout << RepeatFunny("", n) << "\n";
}