#include <iostream>
#include <random>
#include <algorithm>
using namespace std;

int main(){
	int64_t n;
	cin >> n;
	random_device rnd;
	mt19937 mt(rnd());
	while(true){
		int64_t a = mt(), b = n - a;
		string s = to_string(a), t = to_string(b);
		if(count(s.begin(), s.end(), '7') == 0 && count(t.begin(), t.end(), '7') == 0 && -1e9 <= a && a <= 1e9 && -1e9 <= b && b <= 1e9){
			cout << a << ' ' << b << endl;
			return 0;
		}
	}
}