You have a blackboard and initially only an odd number x is written on it. Your goal is to write the number 1 on the blackboard.

You may write new numbers on the blackboard with the following two operations. 

  * You may take two numbers (not necessarily distinct) already on the blackboard and write their sum on the blackboard. The two numbers you have chosen remain on the blackboard. 
  * You may take two numbers (not necessarily distinct) already on the blackboard and write their [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) on the blackboard. The two numbers you have chosen remain on the blackboard. 

Perform a sequence of operations such that at the end the number 1 is on the blackboard.

Input

The single line of the input contains the odd integer x (3 ≤ x ≤ 999,999).

Output

Print on the first line the number q of operations you perform. Then q lines should follow, each describing one operation. 

  * The "sum" operation is described by the line "a + b", where a, b must be integers already present on the blackboard. 
  * The "xor" operation is described by the line "a ^ b", where a, b must be integers already present on the blackboard. 

The operation symbol (+ or ^) must be separated from a, b by a whitespace.

You can perform at most 100,000 operations (that is, q≤ 100,000) and all numbers written on the blackboard must be in the range [0, 5⋅10^{18}]. It can be proven that under such restrictions the required sequence of operations exists. You can output any suitable sequence of operations.

Examples

Input


3


Output


5
3 + 3
3 ^ 6
3 + 5
3 + 6
8 ^ 9


Input


123


Output


10
123 + 123
123 ^ 246
141 + 123
246 + 123
264 ^ 369
121 + 246
367 ^ 369
30 + 30
60 + 60
120 ^ 121

Difficulty: VERY_HARD
Tags: Bit manipulation

Constructive algorithms

Number theory

Mathematics

Matrices
Skill types: Bit manipulation

Starter code:

Solutions:
import os
import sys
from io import BytesIO, IOBase

def main():
	print('500')
	cnt = 500
	x = int(input())
	if x % 4 == 3:
		print(str(x) + ' + ' + str(x))
		print(str(2 * x) + ' + ' + str(x))
		cnt -= 2
		x *= 3
	xCpy = x
	bigX = x
	while xCpy != 1:
		print(str(bigX) + ' + ' + str(bigX))
		cnt -= 1
		xCpy //= 2
		bigX *= 2
	print(str(bigX) + ' + ' + str(x))
	ans1 = bigX + x
	print(str(bigX) + ' ^ ' + str(x))
	ans2 = bigX ^ x
	print(str(ans1) + ' ^ ' + str(ans2))
	ans = ans1 ^ ans2
	cnt -= 3
	curX = x
	while ans != 1:
		curX = x
		while curX != 0:
			print(str(curX) + ' + ' + str(curX))
			cnt -= 1
			curX *= 2
			if curX >= ans:
				print(str(ans) + ' ^ ' + str(curX))
				cnt -= 1
				curX ^= ans
		ans //= 2
		if x >= ans:
			print(str(x) + ' ^ ' + str(ans))
			cnt -= 1
			x ^= ans
	while cnt > 0:
		cnt -= 1
		print(str(x) + ' + ' + str(x))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import log2, ceil

def lg(val):
	return ceil(log2(val))

class Xum:

	def __init__(self, x):
		self.board = [x]
		self.actions = []
		self.x2i_index = 1
		self.x_index = 0
		if self.isOn(x, 1):
			self.performSum(self.getLast(), self.getLast())
			self.performXor(self.board[0], self.board[1])
			self.x2i_index = 3
			self.x_index = 2
		self.k = lg(self.getLast())
		self.generateProducts()
		self.constructP()
		self.performSum(self.getLast(), self.board[self.x_index])
		self.performXor(self.board[-2], self.board[self.x_index])
		self.performXor(self.board[-2], self.board[-1])
		self.index_2 = len(self.board) - 1
		self.powerOf2()
		self.maskX()

	def isOn(self, val, index):
		return val >> index & 1

	def performSum(self, a, b):
		s = a + b
		self.board.append(s)
		self.actions.append(f'{a} + {b}')
		return s

	def performXor(self, a, b):
		xor = a ^ b
		self.board.append(xor)
		self.actions.append(f'{a} ^ {b}')
		return xor

	def getLast(self):
		return self.board[-1]

	def generateProducts(self):
		for i in range(1, self.k + 1):
			self.performSum(self.getLast(), self.getLast())

	def constructP(self):
		p = self.board[self.x_index]
		for i in range(1, self.k + 1):
			if self.isOn(p, i):
				p = self.performXor(p, self.board[self.x2i_index + i - 1])

	def powerOf2(self):
		assert self.getLast() == 2
		for i in range(2, self.k + 1):
			self.performSum(self.getLast(), self.getLast())

	def maskX(self):
		x = self.board[self.x_index]
		for i in range(1, self.k + 1):
			if self.isOn(x, i):
				x = self.performXor(x, self.board[self.index_2 + i - 1])

	def __str__(self):
		total = str(len(self.actions)) + '\n'
		return total + '\n'.join(self.actions)

def xum(x):
	sol = Xum(x)
	print(sol)
x = int(input())
xum(x)


def GSB(n):
	ans = 0
	for i in range(63):
		if 1 << i & n:
			ans = i
	return ans

def pop_count(n):
	ans = 0
	for i in range(63):
		if 1 << i & n:
			ans += 1
	return ans
exists = []
ops = []

def add(a, b):
	assert a in exists and b in exists
	ops.append(f'{a} + {b}')
	exists.append(a + b)
	assert a + b <= 5 * 10 ** 18
	return a + b

def xor(a, b):
	assert a in exists and b in exists
	ops.append(f'{a} ^ {b}')
	exists.append(a ^ b)
	assert a ^ b <= 5 * 10 ** 18
	return a ^ b
n = int(input())
exists.append(n)
x = n
for i in range(GSB(n)):
	x = add(x, x)
x1 = xor(n, x)
x2 = add(x1, x)
x3 = add(x, x)
x4 = xor(x2, x3)
powerOfTwo = xor(x4, n)
cleaners = [powerOfTwo]
for i in range(40):
	cleaners.append(add(cleaners[-1], cleaners[-1]))

def clean(n):
	for p in cleaners:
		if n & p:
			n = xor(n, p)
	return n
v = n
for i in range(1, 20 + 1):
	if 1 << i & v:
		v = clean(xor(v, n << i))
assert 1 in exists
print(len(ops))
for op in ops:
	print(op)


def pr(ans):
	print(len(ans))
	for i in ans:
		if i[0] == 1:
			print(i[1], '+', i[2])
		else:
			print(i[1], '^', i[2])

def fi2(st):
	return pow(2, st - 1)

def colv(num, fi, mod):
	return pow(num, fi - 1, mod)
step2 = set()
for i in range(64):
	step2.add(pow(2, i))
a = int(input())
ans = []
x = a
k = 0
for i in range(100):
	ans.append([1, x, a])
	y = x + a
	if y in step2:
		k = y
		break
	ans.append([2, x, y])
	x = y ^ x
	if x in step2:
		k = x
		break
if k == 1:
	pr(ans)
	exit()
stk = 0
kcopy = k
while kcopy % 2 == 0:
	stk += 1
	kcopy //= 2
step = fi2(stk)
num = colv(a, step, k) - 1
tosteps = [a]
for i in range(1, 64):
	ans.append([1, tosteps[-1], tosteps[-1]])
	t = tosteps[-1] * 2
	if t >= k:
		ans.append([2, t, k])
		t -= k
	tosteps.append(t)
an = a
for i in range(64):
	if num % 2 == 1:
		ans.append([1, an, tosteps[i]])
		an += tosteps[i]
		if an > k:
			ans.append([2, an, k])
			an -= k
	num //= 2
pr(ans)


x = int(input())
X = x
ans = []
t = x
st = set()
while x & t != 1:
	t += x
ans.append((t, '+', x))
ans.append((t, '^', x))
ans.append((t + x, '+', t ^ x))
ans.append((t ^ x, '+', t ^ x))
ans.append((t + x + (t ^ x), '^', t + x + (t ^ x) - 2))
p = 2
while x > 1:
	if x & p:
		ans.append((p, '^', x))
		x ^= p
	ans.append((p, '+', p))
	p += p
ans1 = []
q = t // X - 1
tmp = X
re = X
while q > 0:
	if q & 1:
		ans1.append((re, '+', tmp))
		re += tmp
	ans1.append((tmp, '+', tmp))
	tmp += tmp
	q >>= 1
ans = ans1 + ans
print(len(ans))
for row in ans:
	print(*row)


from math import gcd
from itertools import product

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(gcd, x, y) = egcd(b % a, a)
		return (gcd, y - b // a * x, x)

def make_muls(o, A):
	s = bin(A)
	s = s[2:][::-1]
	i = len(s)
	r = []
	it = 0
	while i > 0:
		i -= 1
		if s[i] == '1':
			r.append(str(o * it) + ' + ' + str(o))
			it += 1
		r.append(str(o * it) + ' + ' + str(o * it))
		it *= 2
	return r[1:]
inp = int(input())
if inp % 2 == 0:
	inp += 1
ops = []
A = 0
B = 0
for z in range(1, 10000000):
	if (inp * z ^ inp) % 2 == 1 and gcd(inp, inp * z ^ inp) == 1:
		A = 1
		B = z
		break
ops = make_muls(inp, A)
ops += make_muls(inp, B)
ops += [str(inp * A) + ' ^ ' + str(inp * B)]
X = inp * A
Y = inp * B ^ inp * A
(_, C, D) = egcd(X, Y)
(C, D) = (abs(C), abs(D))
if max(X * C, Y * D) % 2 == 0:
	C += Y
	D += X
ops += make_muls(X, C)
ops += make_muls(Y, D)
ops += [str(X * C) + ' ^ ' + str(Y * D)]
print(len(ops))
for o in ops:
	print(o)


from __future__ import division, print_function
from operator import *
import os
import sys
from io import BytesIO, IOBase

class TailRecurseException(BaseException):

	def __init__(self, args, kwargs):
		self.args = args
		self.kwargs = kwargs

def tail_call_optimized(g):

	def func(*args, **kwargs):
		f = sys._getframe()
		if f.f_back and f.f_back.f_back and (f.f_back.f_back.f_code == f.f_code):
			raise TailRecurseException(args, kwargs)
		else:
			while 1:
				try:
					return g(*args, **kwargs)
				except TailRecurseException as e:
					args = e.args
					kwargs = e.kwargs
	func.__doc__ = g.__doc__
	return func

def identity(g):
	return g
tco = identity
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
from collections import defaultdict
____dm = None
ONLINE_JUDGE = __debug__

def inputline():
	global inp
	inp = input().split()
	inp.reverse()

def readint():
	return int(inp.pop())

def readfloat():
	return float(inp.pop())

def nextline():
	return inputline()

def void(*arg):
	return None
displayln = print
println = print
if ONLINE_JUDGE:
	dbgln = void
else:
	dbgln = print

def add1(x):
	return x + 1

def sub1(x):
	return x - 1

def ceildiv(a, b):
	return -(-a // b)

def g231():

	def lo_0(x_1):

		def do_3(j_4):
			g133 = gt(j_4, x_1)
			if g133 != False:
				return j_4
			else:
				g134 = mul(2, j_4)
				return do_3(g134)
		g135 = do_3
		lb2_2 = g135(1)

		def do_5(i_6, j_7, t_8):
			g136 = gt(j_7, x_1)
			if g136 != False:
				return t_8
			else:
				g137 = truediv(i_6, 2)
				g138 = add(j_7, i_6)
				g139 = add1(t_8)
				return do_5(g137, g138, g139)
		g140 = do_5
		g141 = truediv(lb2_2, 4)
		g142 = truediv(lb2_2, 2)
		return g140(g141, g142, 0)
	global cnt_9
	cnt_9 = 120

	def solve_lo1_10(x_11):
		global cnt_9

		def do_13(i_14, j_15):
			g143 = gt(j_15, x_11)
			if g143 != False:
				return i_14
			else:
				g144 = add1(i_14)
				g145 = mul(2, j_15)
				return do_13(g144, g145)
		g146 = do_13
		btx_12 = g146(0, 1)
		g147 = sub(btx_12, 1)
		g148 = pow(2, g147)
		y_16 = mul(x_11, g148)
		i_17 = sub(btx_12, 1)

		def do_18(x_19, i_20):
			global cnt_9
			g149 = eq(i_20, 0)
			if g149 != False:
				return None
			else:
				g150 = sub1(cnt_9)
				_151 = cnt_9 = g150
				void()
				print(x_19, '+', x_19)
				g152 = mul(2, x_19)
				g153 = sub(i_20, 1)
				return do_18(g152, g153)
		g154 = do_18
		g154(x_11, i_17)
		a_21 = add(y_16, x_11)
		g155 = sub1(cnt_9)
		_156 = cnt_9 = g155
		void()
		print(y_16, '+', x_11)
		b_22 = xor(y_16, x_11)
		g157 = sub1(cnt_9)
		_158 = cnt_9 = g157
		void()
		print(y_16, '^', x_11)
		c_23 = xor(a_21, b_22)
		g159 = sub1(cnt_9)
		_160 = cnt_9 = g159
		void()
		print(a_21, '^', b_22)
		loc_24 = lo_0(c_23)
		g161 = gt(loc_24, 1)
		if g161 != False:
			c2_25 = add(c_23, c_23)
			a_27 = c_23
			b_26 = c_23
			g162 = sub1(cnt_9)
			_163 = cnt_9 = g162
			void()
			print(a_27, '+', b_26)
			q_28 = xor(c_23, c2_25)
			a_29 = c_23
			g164 = sub1(cnt_9)
			_165 = cnt_9 = g164
			void()
			print(a_29, '^', c2_25)
			g166 = pow(2, loc_24)
			w_30 = mul(q_28, g166)

			def do_31(x_32, i_33):
				global cnt_9
				g167 = eq(i_33, 0)
				if g167 != False:
					return None
				else:
					g168 = sub1(cnt_9)
					_169 = cnt_9 = g168
					void()
					print(x_32, '+', x_32)
					g170 = mul(2, x_32)
					g171 = sub(i_33, 1)
					return do_31(g170, g171)
			g172 = do_31
			g172(q_28, loc_24)
			qa_34 = add(q_28, w_30)
			g173 = sub1(cnt_9)
			_174 = cnt_9 = g173
			void()
			print(q_28, '+', w_30)
			qb_35 = xor(q_28, w_30)
			g175 = sub1(cnt_9)
			_176 = cnt_9 = g175
			void()
			print(q_28, '^', w_30)
			qc_36 = xor(qa_34, qb_35)
			g177 = sub1(cnt_9)
			_178 = cnt_9 = g177
			void()
			print(qa_34, '^', qb_35)
			g179 = mul(2, q_28)
			qd_37 = xor(qc_36, g179)
			b_38 = mul(2, q_28)
			g180 = sub1(cnt_9)
			_181 = cnt_9 = g180
			void()
			print(qc_36, '^', b_38)
			g182 = sub(loc_24, 1)
			g183 = pow(2, g182)
			qe_39 = mul(qd_37, g183)
			i_40 = sub(loc_24, 1)

			def do_41(x_42, i_43):
				global cnt_9
				g184 = eq(i_43, 0)
				if g184 != False:
					return None
				else:
					g185 = sub1(cnt_9)
					_186 = cnt_9 = g185
					void()
					print(x_42, '+', x_42)
					g187 = mul(2, x_42)
					g188 = sub(i_43, 1)
					return do_41(g187, g188)
			g189 = do_41
			g189(qd_37, i_40)
			qqq_44 = xor(q_28, qe_39)
			g190 = sub1(cnt_9)
			_191 = cnt_9 = g190
			void()
			print(q_28, '^', qe_39)
			_192 = c_23 = qqq_44
			void()
		else:
			None
		g193 = sub(btx_12, 2)
		g194 = pow(2, g193)
		mul(c_23, g194)
		x_46 = c_23
		i_45 = sub(btx_12, 2)

		def do_47(x_48, i_49):
			global cnt_9
			g195 = eq(i_49, 0)
			if g195 != False:
				return None
			else:
				g196 = sub1(cnt_9)
				_197 = cnt_9 = g196
				void()
				print(x_48, '+', x_48)
				g198 = mul(2, x_48)
				g199 = sub(i_49, 1)
				return do_47(g198, g199)
		g200 = do_47
		g200(x_46, i_45)

		def do_51(i_52, k_53, j_54):
			g201 = eq(i_52, c_23)
			if g201 != False:
				return j_54
			else:
				g202 = mul(2, i_52)
				g203 = mul(2, k_53)
				g204 = and_(j_54, i_52)
				g205 = eq(g204, 0)

				def g208():
					global cnt_9
					if g205 != False:
						return j_54
					else:
						nj_55 = xor(j_54, k_53)
						g206 = sub1(cnt_9)
						_207 = cnt_9 = g206
						void()
						print(j_54, '^', k_53)
						return nj_55
				g208 = g208()
				return do_51(g202, g203, g208)
		g209 = do_51
		g210 = mul(2, x_11)
		global f_50
		f_50 = g209(2, g210, x_11)

		def do_56(qq_57):
			global f_50
			global cnt_9
			g211 = gt(qq_57, f_50)
			if g211 != False:
				return None
			else:
				g212 = and_(qq_57, f_50)
				g213 = gt(g212, 0)
				if g213 != False:
					nf_58 = xor(qq_57, f_50)
					b_59 = f_50
					g214 = sub1(cnt_9)
					_215 = cnt_9 = g214
					void()
					print(qq_57, '^', b_59)
					_216 = f_50 = nf_58
					void()
				else:
					None
				g217 = mul(2, qq_57)
				return do_56(g217)
		g218 = do_56
		return g218(c_23)
	n_60 = readint()
	print(120)
	g219 = eq(n_60, 1)
	if g219 != False:
		None
	else:
		g220 = lo_0(n_60)
		g221 = gt(g220, 1)
		if g221 != False:
			x2_61 = add(n_60, n_60)
			g222 = sub1(cnt_9)
			_223 = cnt_9 = g222
			void()
			print(n_60, '+', n_60)
			y_62 = xor(n_60, x2_61)
			g224 = sub1(cnt_9)
			_225 = cnt_9 = g224
			void()
			print(n_60, '^', x2_61)
			solve_lo1_10(y_62)
		else:
			solve_lo1_10(n_60)

	@tail_call_optimized
	def do_63(cnt_64):
		global cnt_9
		g226 = eq(cnt_64, 0)
		if g226 != False:
			return None
		else:
			g227 = sub1(cnt_9)
			_228 = cnt_9 = g227
			void()
			print(n_60, '+', n_60)
			g229 = sub1(cnt_64)
			return do_63(g229)
	g230 = do_63
	return g230(cnt_9)
_232 = main = g231
void()
None
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
inputline()
main()


import math
x = int(input())
ops = []

def ext_euc(a, b):
	s = 0
	old_s = 1
	t = 1
	old_t = 0
	while a != 0:
		q = b // a
		r = b % a
		(m, n) = (old_s - s * q, old_t - t * q)
		(b, a, old_s, old_t, s, t) = (a, r, s, t, m, n)
	return (b, old_s, old_t)

def get_mul(a, b):
	base = a
	cur = 0
	while b > 0:
		if b % 2 == 1:
			if cur > 0:
				ops.append(str(cur) + ' + ' + str(base))
			cur += base
		ops.append(str(base) + ' + ' + str(base))
		base = 2 * base
		b = b // 2
	return cur
e = math.floor(math.log2(x))
for i in range(e):
	ops.append(str(x * (1 << i)) + ' + ' + str(x * (1 << i)))
ops.append(str(x) + ' ^ ' + str((1 << e) * x))
y = (1 << e) * x ^ x
pair = ext_euc(x, -y)
p = pair[2]
q = pair[1]
while p < 0 or q < 0:
	p += y
	q += x
if q % 2 == 1:
	p += y
	q += x
pro1 = get_mul(x, p)
pro2 = get_mul(y, q)
ops.append(str(pro1) + ' ^ ' + str(pro2))
print(len(ops))
for i in ops:
	print(i)


n = int(input())
out = []
if n >> 1 & 1:
	out.append(str(n) + ' + ' + str(n))
	out.append(str(2 * n) + ' ^ ' + str(n))
	n = 2 * n ^ n
m = n.bit_length() - 1
a = n
b = n
for i in range(m):
	out.append(str(b) + ' + ' + str(b))
	b *= 2
out.append(str(a) + ' + ' + str(b))
c = a + b
out.append(str(a) + ' ^ ' + str(b))
d = a ^ b
out.append(str(c) + ' ^ ' + str(d))
e = c ^ d
a = n
b = e
while True:
	if a == 1 or b == 1:
		break
	if a > b:
		(a, b) = (b, a)
	pre_a = a
	A = a.bit_length() - 1
	B = b.bit_length() - 1
	for i in range(B - A):
		out.append(str(a) + ' + ' + str(a))
		a *= 2
	out.append(str(a) + ' ^ ' + str(b))
	b = a ^ b
	a = pre_a
print(len(out))
for s in out:
	print(s)


from sys import stdin
output = []

def queue(stri):
	output.append(stri)
n = int(stdin.readline())
digits = len(bin(n)) - 2
cpy = n
for _ in range(digits - 1):
	queue(f'{cpy} + {cpy}')
	cpy *= 2
m = n ^ cpy
queue(f'{n} ^ {cpy}')
p = n * m - 1
while p % n != 0:
	p -= m

def foo(number, target):
	current = number
	while current * 2 <= target:
		queue(f'{current} + {current}')
		current *= 2
	total = current
	while total < target:
		if total + current <= target:
			queue(f'{total} + {current}')
			total += current
		current //= 2
foo(m, p + 1)
foo(n, p)
if p % 2 == 0:
	queue(f'{p + 1} ^ {p}')
else:
	queue(f'{p} + {n}')
	queue(f'{p + 1} + {n}')
	queue(f'{p + n + 1} ^ {p + n}')
print(len(output))
for s in output:
	print(s)


n = int(input())
import random
out = []
b2 = [n]
for i in range(41):
	out.append('{0} + {0}'.format(b2[-1]))
	b2.append(2 * b2[-1])
b2 = b2[::-1]
basis = []
for j in range(1000):
	i = random.randint(1, n * n + 50)
	want = n * i
	for v in basis:
		if want ^ v < want:
			want = want ^ v
	if want > 0:
		add = []
		w2 = n * i
		for v in b2:
			if v <= w2:
				w2 -= v
				add.append(v)
		while len(add) > 1:
			(u, v) = (add.pop(), add.pop())
			out.append('{1} + {0}'.format(u, v))
			add.append(u + v)
		assert add[0] == n * i
		w2 = n * i
		for v in basis:
			if w2 ^ v < w2:
				out.append('{1} ^ {0}'.format(w2, v))
				w2 = w2 ^ v
		basis.append(want)
		basis.sort(reverse=True)
print(len(out))
print('\n'.join(out))


N = 1000
q = [0, 0, 1, 1] + [0, 1] * (N // 2)
for i in range(3, N, 2):
	if q[i]:
		for j in range(3 * i, N, 2 * i):
			q[j] = 0
p = []
for i in range(2, N):
	if q[i]:
		p.append(i)

def phi(n):
	r = 1
	for i in p:
		if n % i < 1:
			r *= i - 1
			n //= i
			while n % i < 1:
				n //= i
				r *= i
	r *= max(n - 1, 1)
	return r
n = int(input())
o = []
vn = bin(n)[3:]
kn = n
for i in range(len(vn)):
	o.append(f'{kn} + {kn}')
	kn *= 2
o.append(f'{kn} ^ {n}')
a = kn ^ n
b = pow(a, phi(n) - 1, n)
if b % 2 < 1:
	b += n
v = bin(b)[3:]
k = a
for i in range(len(v)):
	o.append(f'{k} + {k}')
	k *= 2
j = k
k //= 2
for i in range(len(v)):
	if v[i] == '1':
		o.append(f'{j} + {k}')
		j += k
	k //= 2
c = j // n
v = bin(c)[3:]
k = kn
for i in range(len(v) - len(vn)):
	o.append(f'{k} + {k}')
	k *= 2
l = k
k //= 2
for i in range(len(v)):
	if v[i] == '1':
		o.append(f'{l} + {k}')
		l += k
	k //= 2
o.append(f'{j} ^ {l}')
print(len(o))
print('\n'.join(o))


import sys
x = int(sys.stdin.readline())
ans = []
c = 0
while x > 1:
	if bin(x).count('0') == 1:
		z = x
		while 2 * z + x != 2 * z ^ x:
			ans.append(str(z) + ' + ' + str(z))
			z = z + z
		ans.append(str(x) + ' + ' + str(z))
		z1 = x + z
		ans.append(str(x) + ' ^ ' + str(z1))
		z2 = x ^ z1
		ans.append(str(x) + ' + ' + str(z2))
		z3 = x + z2
		ans.append(str(z1) + ' ^ ' + str(z3))
		z4 = z1 ^ z3
		ans.append(str(x) + ' + ' + str(x))
		z5 = x + x
		ans.append(str(z4) + ' ^ ' + str(z5))
		z6 = z4 ^ z5
		ans.append(str(x) + ' ^ ' + str(z6))
		x = x ^ z6
	else:
		c = c + 1
		z = x
		s = bin(x)[2:]
		i = 0
		while bin(x + z).count('1') % bin(x).count('1') == 0:
			i = i + 1
			ans.append(str(z) + ' + ' + str(z))
			z = z * 2
		ans.append(str(x) + ' + ' + str(z))
		y = x + z
		while len(bin(z)) < len(bin(y)):
			ans.append(str(z) + ' + ' + str(z))
			z = z * 2
		while y > x or y % 2 == 0:
			if y > x:
				while len(bin(z)) > len(bin(y)):
					z = z // 2
				ans.append(str(z) + ' ^ ' + str(y))
				y = y ^ z
			else:
				while len(bin(y)) < len(bin(x)):
					ans.append(str(y) + ' + ' + str(y))
					y = y * 2
				ans.append(str(x) + ' ^ ' + str(y))
				y = x ^ y
		x = y
print(len(ans))
for i in ans:
	print(i)


import io
import os
from collections import Counter, defaultdict, deque

def solve(X):
	ops = []

	def plus(x, y):
		ops.append(str(x) + ' + ' + str(y))
		return x + y

	def xor(x, y):
		ops.append(str(x) + ' ^ ' + str(y))
		return x ^ y
	nums = [X]
	for i in range(X.bit_length()):
		nums.append(plus(nums[-1], nums[-1]))
	curr = X
	for i in range(1, X.bit_length() + 1):
		if 1 << i & curr:
			curr = xor(curr, nums[i])
	assert curr & (1 << X.bit_length()) - 1 == 1
	if X % 4 == 1:
		Y = X
	else:
		assert X % 4 == 3
		Y = xor(X, plus(X, X))
	Y2 = Y
	for i in range(Y.bit_length() - 1):
		Y2 = plus(Y2, Y2)
	assert Y & Y2 == 1 << Y.bit_length() - 1
	pow2 = xor(plus(Y, Y2), xor(Y, Y2))
	assert bin(pow2).count('1') == 1
	while curr != 1:
		if pow2 & curr:
			curr = xor(pow2, curr)
		pow2 = plus(pow2, pow2)
	assert len(ops) <= 100000
	return str(len(ops)) + '\n' + '\n'.join(ops)
if False:
	for x in range(3, 100000, 2):
		solve(x)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(X,) = [int(x) for x in input().split()]
ans = solve(X)
print(ans)


import sys
input = sys.stdin.readline
from math import gcd
x = int(input())
import random
XLIST = [x]
XSET = set()

def Ext_Euc(a, b, axy=(1, 0), bxy=(0, 1)):
	(q, r) = divmod(a, b)
	if r == 0:
		return (bxy, b)
	rxy = (axy[0] - bxy[0] * q, axy[1] - bxy[1] * q)
	return Ext_Euc(b, r, bxy, rxy)
ANS = []
USED = set()
flag = 0
while True:
	if flag:
		break
	x = random.choice(XLIST)
	if x in USED:
		continue
	USED.add(x)
	y = x
	for i in range(20):
		if gcd(x, y ^ x) == 1:
			(k, l) = Ext_Euc(x, y ^ x)[0]
			(tt, tu) = (abs(k) * x, (y ^ x) * abs(l))
			if tt ^ tu == 1:
				flag = 1
				break
			else:
				ANS.append(str(x) + ' ^ ' + str(y))
				XLIST.append(x ^ y)
		else:
			ANS.append(str(y) + ' + ' + str(y))
			if y <= 999999:
				XLIST.append(x)
			y = 2 * y
z = y ^ x
ANS.append(str(y) + ' ^ ' + str(x))
A = Ext_Euc(x, z)
(k, l) = (abs(A[0][0]), abs(A[0][1]))
XLIST = [x]
ANS.append(str(x) + ' + ' + str(x))
x = x + x
while x < 25 * 10 ** 17:
	XLIST.append(x)
	ANS.append(str(x) + ' + ' + str(x))
	x = 2 * x
ZLIST = [z]
ANS.append(str(z) + ' + ' + str(z))
z = z + z
while z < 25 * 10 ** 17:
	ZLIST.append(z)
	ANS.append(str(z) + ' + ' + str(z))
	z = 2 * z
XLIST2 = [0] * 60
for i in range(60):
	if k & 1 << i != 0:
		XLIST2[i] = 1
flag = 0
for i in range(60):
	if XLIST2[i] == 1:
		if flag == 0:
			NOW = XLIST[i]
			flag = 1
		else:
			ANS.append(str(NOW) + ' + ' + str(XLIST[i]))
			NOW += XLIST[i]
NOW0 = NOW
ZLIST2 = [0] * 60
for i in range(60):
	if l & 1 << i != 0:
		ZLIST2[i] = 1
flag = 0
for i in range(60):
	if ZLIST2[i] == 1:
		if flag == 0:
			NOW = ZLIST[i]
			flag = 1
		else:
			ANS.append(str(NOW) + ' + ' + str(ZLIST[i]))
			NOW += ZLIST[i]
NOW1 = NOW
ANS.append(str(NOW0) + ' ^ ' + str(NOW1))
print(len(ANS))
for ans in ANS:
	print(ans)