b = []
def all_order (a,start,end): #全排列,即将输入的四个扑克进行全排列,输出4*3*2*1个组合
if(start == end):
b.append([a[0],a[1],a[2],a[3]])
else:
for i in range(start,end + 1):
d = a[i]
a[i] = a[start]
a[start] = d
all_order(a, start + 1, end)
d = a[i]
a[i] = a[start]
a[start] = d
while True:
try:
poker = input().split()
if('joker' in poker) or ('Joker' in poker): #有大小王则无法计算
print('ERROR')
continue
S = {'2':'2', '3':'3', '4':'4', '5':'5', '6':'6', '7':'7', '8':'8', '9':'9', '10':'10', 'A':'1', 'J':'11', 'Q':'12', 'K':'13'} #将扑克牌和对应的值存入字典
sign = ['+','-','*','/'] #四个符号
all_order(poker, 0, 3)
c = []
for i in range(4):
for j in range(4):
for k in range(4): #穷举
for z in range(24):
if(int(eval('(' + '(' + S[b[z][0]] + sign[i] + S[b[z][1]] + ')' + sign[j] + S[b[z][2]] + ')' + sign[k] + S[b[z][3]])) == 24): #通过eval计算值,加括号的意义是使例如1+2*3 的值为9而不是7
c.append(b[z][0] + sign[i] + b[z][1] + sign[j] + b[z][2] + sign[k] + b[z][3]) #将所有得到24的组合算式放入c
if(len(c) == 0): #没有等于24的
print('NONE')
else: #若是有则输出第一个即可
print(c[0])
except:
break