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
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define VAR(v,w) __typeof(w) v=(w)
#define FORE(it,c) for(VAR(it,(c).begin());it!=(c).end();++it)
#define PB push_back
#define SIZE(c) ((int)(c).size())
#define INT(x) int x; scanf("%d", &x)
#define LLG(x) LL x; scanf("%lld", &x)

typedef long long LL;
typedef vector<int> VI;

void go(char c, LL n) {
	while (n) {
		LL k = 1;
		VI v;
		while (n / k > 1) {
			int f = min(n / k, 9LL);
			v.PB(f);
			k *= f;
		}
		bool start = 1;
		FORE(it,v) {
			if (!start) putchar('[');
			start = 0;
			putchar('0' + *it);
		}
		putchar(c);
		int h = max(SIZE(v) - 1, 0);
		REP(i,h) putchar(']');
		n -= k;
	}
}

void saw(LL n) {
	--n;
	while (n) {
		LL k = 1;
		VI v;
		while (n / k > 1) {
			int f = min(n / k, 9LL);
			v.PB(f);
			k *= f;
		}
		FORE(it,v) {
			putchar('0' + *it);
			putchar('[');
		}
		putchar('E');
		putchar('A');
		int h = SIZE(v);
		REP(i,h) putchar(']');
		n -= k;
	}
	putchar('E');
}

void re(LL n) {
	LL n0 = n;
	--n;
	while (n) {
		LL k = 1;
		VI v;
		while (n / k > 1) {
			int f = min(n / k, 9LL);
			v.PB(f);
			k *= f;
		}
		FORE(it,v) {
			putchar('0' + *it);
			putchar('[');
		}
		saw(n0);
		go('C', n0);
		int h = SIZE(v);
		REP(i,h) putchar(']');
		n -= k;
	}
	saw(n0);
}

void pi(LL n) {
	if (!n) return;
	int p = n >> 1;
	int a = n - p;
	go('A', a);
	pi(p);
	re(a);
	pi(p);
	go('C', a);
}

int main() {
	LLG(n);
	pi(n);
	putchar('\n');
}