#include<iostream>
#include<cmath>
using namespace std;

#define MAX_N 3700000

int prime[MAX_N], twin[MAX_N];

void isprime(int c) {
	prime[2] = 1;
	for (int i = 3; i < c; i += 2) {
		for (int j = 3; j <= sqrt(i); j += 2) {
			if (i%j == 0) { 
				goto E; 
			}
		}
		prime[i] = 1;
	E:;
	}
}

void istwin(int d) {
	for (int i = 5; i < d; i++) {
		if (prime[i - 2] + prime[i] == 2) {
			twin[i] = i;
		}
		else {
			twin[i] = twin[i - 1];
		}
	}
}

int n;

int main() {
	isprime(MAX_N);
	istwin(MAX_N);
	while (true) {
		cin >> n;
		if (n == 0) {
			break;
		}
		cout << twin[n] - 2 << ' ' << twin[n] << endl;
	}
}
#include <bits/stdc++.h>
using namespace std;

int main() {
    string a;
    cin >> a;
    vector<int> X(4);
    for (int i = 0; i < 4; ++i) {
        X[i] = a[i]-'0';
    }
    
    for (int i = 0; i < (1 << 3); ++i) {
        bitset<3> bit(i);
        int sum = X[0];
        vector<string> ans(7);
        ans.push_back(to_string(X[0]));
        for (int j = 0; j < 3; ++j) {
            if (bit.test(j)) {
                sum += X[j+1];
                ans.push_back("+");
            }
            else
            {
                sum -= X[j+1];
                ans.push_back("-");
            }
            ans.push_back(to_string(X[j+1]));
        }
        if (sum == 7) {
            string answer = "";
            for (auto s : ans) {
                answer += s;
            }
            cout << answer << "=7" << endl;
            return 0;
        }
    }
}