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

constexpr int MAXN = 20'000'001;

constexpr long long weight = 200;
constexpr long long weights[] = {0, weight, weight + 3, weight + 3, weight + 3, weight + 3, weight + 3, weight + 3, weight + 3, weight + 3};
long long sum[MAXN];
int best[MAXN];

string multiply_string(string s, long long times) {
	if (times == 1) {
		return s;
	}
	
	long long k = 9;
	if (times < MAXN) {
		k = best[times];
	}
	else {
		bool found = false;
		for (long long i = 9; i >= 3; i--) {
			if (times % i == 0) {
				k = i;
				found = true;
				break;
			}
		}
		if (!found) {
			for (long long i = 9; i >= 5; i--) {
				long long tmp = times / i;
				for (long long j = 9; j >= 5; j--) {
					if (tmp % j == 0) {
						k = i;
						found = true;
						break;
					}
				}
				if (found) {
					break;
				}
			}
		}
	}
	
	long long blocks = times / k, remainder = times % k;
	
	string result = "";
	if (blocks > 0) {
		result = multiply_string(((int) s.size() == 1 ? to_string(k) + s : to_string(k) + "[" + s + "]"), blocks);
	}
	
	if (remainder == 1) {
		result += s;
	}
	else if (remainder > 1) {
		result += to_string(remainder) + ((int) s.size() == 1 ? s : "[" + s + "]");
	}
	
	return result;
}

string triangle(long long n) {
	if (n == 1) {
		return "A";
	}
	else if (n == 2) {
		return "AFDBA";
	}
	
	long long half = (n - 1) / 2;
	string result = multiply_string(triangle(half), 2);
	
	result += multiply_string("E", half);
	
	result += multiply_string(multiply_string("C", half) + multiply_string("EA", half) + "E", half);
	
	if (n % 2 == 1) {
		result += multiply_string("AC", 2 * half) + "A";
	}
	if (n % 2 == 0) {
		result += multiply_string("AEACC", 2 * half) + "AEACA";
	}
	
	return result;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	for (long long i = 1; i <= 9; i++) {
		sum[i] = weights[i];
		best[i] = i;
	}
	for (long long i = 10; i < MAXN; i++) {
		sum[i] = sum[i / 9] + weights[i % 9] + 3;
		best[i] = 9;
		for (long long j = 8; j >= 2; j--) {
			long long maybe = sum[i / j] + weights[i % j] + 3;
			if (maybe < sum[i]) {
				sum[i] = maybe;
				best[i] = j;
			}
		}
	}
	
	long long n;
	cin >> n;
	
	string result = triangle(n) + multiply_string("E", n) + multiply_string("C", n);
	
	cout << result << '\n';
	
	return 0;
}