dic = {
    '2' : 2, '3' : 3, '4' : 4, '5' : 5, '6' : 6, '7' : 7, '8' : 8,
    '9' : 9, '10' : 10, 'J' : 11, 'Q' : 12, 'K' : 13, 'A' : 1
}

def others(lst, idx):
    res = []
    for i in range(len(lst)):
        if i != idx:
            res.append(lst[i])
    return res

def groups(lst):
    res = []
    for idx, i in enumerate(lst):
        lst1 = others(lst, idx)
        for idy, j in enumerate(lst1):
            lst2 = others(lst1, idy)
            l1, l2 = [i, j] + lst2, [i, j] + lst2[::-1]
            if l1 not in res:
                res.append(l1)
            if l2 not in res:
                res.append(l2)
    return res

def dfs(lst, expr):
    if len(lst) == 1:
        if lst[0] == 24:
            return expr
        else:
            return None
    n1, n2 = lst[0], lst[1]
    a = dfs([ n1 + n2 ] + lst[2:], ''.join([expr, '+', str(n2)])) # +
    b = dfs([ n1 - n2 ] + lst[2:], ''.join([expr, '-', str(n2)])) # -
    c = dfs([ n1 * n2 ] + lst[2:], ''.join([expr, '*', str(n2)])) # *
    d = dfs([ n1 / n2 ] + lst[2:], ''.join([expr, '/', str(n2)])) # /
    return a or b or c or d

while True:
    try:
        lst = input().split()
        if 'joker' in lst or 'JOKER' in lst:
            print('ERROR')
            continue
        nums = []
        for i in lst:
            nums.append(dic[i])
            
        def judge(lst):
            for g in groups(lst):
                res = dfs(g, str(g[0]))
                if res:
                    return res
            return None
        
        res = judge(nums)
        if res:
            res = res.replace('13', 'K')
            res = res.replace('12', 'Q')
            res = res.replace('11', 'J')
            res = res.replace('10', 'X')
            res = res.replace('1', 'A')
            res = res.replace('X', '10')
            print(res)
        else:
            print('NONE')
    except:
        break