#include #include #include using namespace std; #define MAXV 1000000000 using ll = long long; int main() { ll N; cin >> N; for (ll bit = 0; bit < (1 << 9); ++bit) { ll t = 0; for (int i = 0; i < 10; ++i) { if (bit >> i & 1) t += pow(10, i); } ll a = t, b = abs(N - a); bool c = true; while (a) { if (a % 10 == 7) c = false; a /= 10; } while (b) { if (b % 10 == 7) c = false; b /= 10; } if (c) { cout << t << " " << N - t << endl; return 0; } } }