#include #define DEBUG(C) cerr << #C << " = " << C << endl using namespace std; long long N; int main() { cin >> N; string s = to_string(N); string ss = string(s.size(), '0'); for (int i = 0; i < s.size(); i++) { if (s[i] == '7') s[i] = '1'; } long long n = stoll(s); cout << N - n << " " << n << endl; return 0; }