#include #include #define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++) using namespace std; string S; int main(void) { cin >> S; reverse(S.begin(), S.end()); int A = 0, N = 0; REP(i, 0, S.size()) { N = N * 10 + (S[i] - '0'); if(S[i] != '7') A = A * 10 + (S[i] - '0'); else A = A * 10 + 6; } cout << A << " " << (N - A) << endl; }