// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-6
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
using namespace std;
// mylittledoge

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	int N;
	cin >> N;
	string s ="((A0|B0)|(A0|B0))";
	for(int i =1; i < N; i++) {
		string x ="", y ="";
		int z =i;
		while(z > 0) {
			x +=char(z%10+'0');
			y +=char(z%10+'0');
			z /=10;}
		x +="A"; y +="B";
		reverse(x.begin(),x.end());
		reverse(y.begin(),y.end());
		string t ="((";
		t +=x;
		t +="|";
		t +=y;
		t +=")|(";
		t +=s;
		t +="|((";
		t +=x;
		t +="|";
		t +=x;
		t +=")|(";
		t +=y;
		t +="|";
		t +=y;
		t +="))))";
		s =t;}
	cout << s << "\n";
	return 0;}

// look at my code
// my code is amazing