# 与题目【24点游戏算法】类似,但返回值不一样 def check(l,n): ss=[0,'A','2','3','4','5','6','7','8','9','10','J','Q','K'] if len(l)==1: if ss.index(l[0])==n: return l[0] else: return None else: for i in range(len(l)): ls=l[:i]+l[i+1:] m=ss.index(l[i]) if check(ls,m+n): return check(ls,m+n)+'-'+l[i] if check(ls,n-m): return check(ls,n-m)+'+'+l[i] if check(ls,n*m): return check(ls,n*m)+'/'+l[i] if check(ls,n/m): return check(ls,n/m)+'*'+l[i] while 1: try: l=input().split() if "joker" in l or "JOKER" in l: print("ERROR") else: ans=check(l,24) print(ans) if ans else print("NONE") except: break