# include # define FOR(i,a,b) for (int i=(a);i<(b);i++) # define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) # define REP(i, n) for (int i = 0; i < (int)(n); i++) # define RREP(i,n) for (int i=(n)-1;i>=0;i--) # define int(x) int x; scanf("%d",&x); # define vint(v,n) vector v(n); REP(i,n) scanf("%d", &v[i]); # define string(x) string x; cin >> x; using namespace std; namespace utils{ template void print(vector> mat) { REP (i, mat.size()) { REP (j, mat[0].size()) cout << mat[i][j] << ' '; cout << endl; } } template void print(vector v) { REP (i, v.size()) if (i >= v.size()-1) cout << v[i]; else cout << v[i] << ' '; cout << endl; } template pair shape(vector> mat) { int d1, d2; d1 = mat.size(); if (d1 > 0) d2 = mat[0].size(); else int d2 = 0; cout << "(" << d1 << ", " << d2 << ")" << endl; return make_pair(0, 0); } template vector> empty(int n, int m) { vector> mat(n, vector(m)); return mat; } } int main() { int(n); int num = n; int cnt = 0; bool flag = false; while(num != 0){ num /= 10; cnt++; } int A[cnt]; int B[cnt]; num = n; for(int i = 0;i <= cnt;i++){ if(num % 10 != 7){ A[i] = num % 10; B[i] = 0; }else{ A[i] = 3; B[i] = 4; } num /= 10; } for(int i = cnt-1;i >= 0;i--) cout << A[i]; cout << " "; for(int i = cnt-1;i >= 0;i--){ if(B[i] != 0) flag = true; if(flag == true) cout << B[i]; } cout << endl; }