#include using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; int n = N; int i = 0; int A = 0; while (n > 0) { int r = n % 10; if (r == 7) { A += 1 * pow(10, i); } else { A += r * pow(10, i); } n /= 10; i++; } int B = N - A; cout << A << " " << B << endl; return 0; }