#include<bits/stdc++.h>
using namespace std;
map<string, int> c2n = {{"A", 1}, {"2", 2}, {"3", 3}, {"4", 4}, {"5", 5}, {"6", 6},{"7", 7}, {"8", 8}, {"9", 9}, {"10", 10}, {"J", 11}, {"Q", 12}, {"K", 13}};
map<int, string> n2c = {{1, "A"}, {2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"},{7, "7"}, {8, "8"}, {9, "9"}, {10, "10"}, {11, "J"}, {12, "Q"}, {13, "K"}};
vector<char> Op = {'+', '-', '*', '/'};
vector<int> n(4);
vector<int>ops;
int cal(int a, int b, int op)
{
if(op == 0) return a + b;
else if (op == 1) return a - b;
else if (op == 2) return a * b;
else return a / b;
}
bool dfs(int start, int sum,vector<int>& ops)
{
sum = cal(sum, n[start], *(ops.end()-1));
if(start == 3)
if(sum == 24) return true;
else return false;
for(int i = 0; i < 4; i++)
{
ops.push_back(i);
if (dfs(start + 1, sum,ops))
return true;
ops.pop_back();
}
return false;
}
int main()
{
vector<string> s(4);
cin >> s[0] >> s[1] >> s[2] >> s[3];
for(int i = 0; i < 4; i++)
{
if(s[i] == "joker" || s[i] == "JOKER")
{
cout << "ERROR" << endl;
return 0;
}
n[i] = c2n[s[i]];
}
sort(n.begin(), n.end());
do
{
vector<int>ops;
for (int i = 0; i < 4; i++)
{
ops.push_back(i);
if (dfs(1, n[0], ops))
{
cout<<n2c[n[0]]<<Op[ops[0]]<<n2c[n[1]]<<Op[ops[1]]<<n2c[n[2]]<<Op[ops[2]]<<n2c[n[3]]<<endl;
return 0;
}
ops.pop_back();
}
} while(next_permutation(n.begin(), n.end()));
cout << "NONE" << endl;
}