#include using namespace std; typedef long long ll; int main(void) { ll N; cin >> N; ll temp = N; ll ans = 0; int di=0; while(N != 0) { if (N % 10 == 7) ans += pow(10, di); N /= 10; di++; } cout << ans << " " << temp - ans << endl; return 0; }