#include <iostream>
#include <string>
#include <vector>
#include <cctype>
using namespace std;
//本体思路结合 HJ67 24点游戏算法 和 HJ43 迷宫问题 ,用一个字符串类似迷宫问题中的path临时存储结果
int count = 0;//记录牌使用情况
int flag = false;//初始化搜索结果
string seq;//记录运算顺序
vector<bool> visited(4,false);//标记牌i是否使用过
vector<string> ch(4,"");//存储输入的牌,放在全局可以直接用temp拼接ch[i],不用再转换

int toNum(string c);//转换字符为数字
void dfs(vector<int> arr, double sum, string temp, string op, int k);//数字数组 点数和 临时运算顺序 运算符 第k张牌

int main() {
    
    while (cin >> ch[0] >> ch[1] >> ch[2] >> ch[3]) {
        
        vector<int> num(4,0);
        for(int i = 0 ; i < 4; i++){
            if(ch[i] == "joker" || ch[i] == "JOKER"){//大小王,输出ERROR结束
                cout << "ERROR" << endl;
                return 0;
            }
            else
                num[i] = toNum(ch[i]);//转换成数字存入数字数组
        }

        string temp = "";//临时存储运算顺序
        dfs(num,0,temp,"0",0);//注意由0开始,会在运算顺序前多个运算符
        if(flag) cout << seq << endl;
        else cout << "NONE" << endl;
        
    }
}

void dfs(vector<int> arr, double sum, string temp, string op, int k){
    if(op == "0") temp += "";//注意由0开始,会在运算顺序前多个运算符
    else if(op == "+") temp += "+" + ch[k];
    else if(op == "-") temp += "-" + ch[k];
    else if(op == "*") temp += "*" + ch[k];
    else  temp += "/" + ch[k];

    if(count == 4 && sum == 24){//当用够4张牌且点数为24点
        if(temp[0] == '+') {//由于sum以0开始, 0 - arr[i]会有非法结果,而0 * / 不影响,故只要+开头的
            flag = 1;//标记成功
            temp.erase(0,1);//去掉首位 ‘+’
            seq = temp;//将运算顺序给全局变量保存
        }
        return ;
    }

    for(int i = 0; i < 4; i++){
        if(visited[i] == false){
            visited[i] = true;//标记牌,避免后续重复使用
            count++;//记录使用牌数
            dfs(arr,sum + arr[i], temp, "+", i);//注意由0开始,会在运算顺序前多个运算符
            dfs(arr,sum - arr[i], temp, "-", i);
            dfs(arr,sum * arr[i], temp, "*", i);
            dfs(arr,sum / arr[i], temp, "/", i);
            visited[i] = false;//回溯
            count--;//回溯
        }
    }
}
int toNum(string c){
    if(c == "J") return 11;
    else if(c == "Q") return 12;
    else if(c == "K") return 13;
    else if(c == "A") return 1;
    else return stoi(c);
}