#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;
long long convert(int num[], int len){
string s = "";
for(int i = 0; i < len; i++){
string c = to_string(num[i]);
s += c;
}
return stoll(s);
}
int main(){
string n;
while(cin >> n){
int len = n.length();
long long min, max, diff;
int numbers[len];
string s;
for(int i = 0; i < len; i++){
numbers[i] = n[i] - '0';
}
sort(numbers, numbers+ len, greater<int>());
max = convert(numbers, len);
//sort by descending then swap first non zero element
sort(numbers, numbers+len);
for(int i = 0; i < len; i++){
if(numbers[i] == 0){
for(int j = i; j < len; j++){
if(numbers[j] != 0){
swap(numbers[i], numbers[j]);
break;
}
}
break;
}
}
min = convert(numbers, len);
diff = max - min;
cout << max << " - " << min << " = " << diff << " = 9 * " << diff/9 << endl;
}
return 0;
}