#include<bits/stdc++.h>
using namespace std;
map<string, int> table;
vector<int> path(4, 0);
vector<char> vis(4, false);
bool found = false;
void init(map<string, int>& table) {
for(int i = 2; i <= 10; i++) table[to_string(i)] = i;
table["A"] = 1;
table["J"] = 11;
table["Q"] = 12;
table["K"] = 13;
}
string id(int x) { for(auto it : table) if(it.second == x) return it.first; return "NAN";}
bool dfs(vector<int>& num, vector<char>& ops, int begin, int result) {
if(begin == num.size() && result == 24) {
stringstream ss;
ss << id(path[0]) << ops[0]
<< id(path[1]) << ops[1]
<< id(path[2]) << ops[2] << id(path[3]);
cout << ss.str() << endl;
found = true;
return true;
}
for(int i = 0; i < num.size(); i++) {
if(vis[i]) continue;
vis[i] = true;
path[begin] = num[i];
{
ops[begin-1] = '+';
if(dfs(num, ops, begin+1, result + path[begin])) return true;
ops[begin-1] = '-';
if(dfs(num, ops, begin+1, result - path[begin])) return true;
ops[begin-1] = '*';
if(dfs(num, ops, begin+1, result * path[begin])) return true;
ops[begin-1] = '/';
//if(result % path[begin] == 0)
if(dfs(num, ops, begin+1, result / path[begin])) return true;
}
vis[i] = false;
}
return false;
}
int main(void)
{
#ifndef ONLINE_JUDGE
ifstream cin("in.txt");
#endif
init(table);
string str[4];
while(cin >> str[0] >> str[1] >> str[2] >> str[3]) {
vector<int> num;
for(auto s : str) if(table.count(s)) num.push_back(table[s]);
if(num.size() != 4) {cout << "ERROR" << endl; continue;}
vector<char> ops(3);
for(int i = 0; i < 4; i++) {
path[0] = num[i];
vis[i] = true;
if(dfs(num, ops, 1, path[0])) break;
vis[i] = false;
}
if(!found) cout << "NONE" << endl;
}
return 0;
}