import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String N = scan.next(); scan.close(); StringBuilder A = new StringBuilder(); StringBuilder B = new StringBuilder(); for(int i = 0; i < N.length(); i++) { char c = N.charAt(i); int k = Character.getNumericValue(c); if(k == 7) { A.append(3); B.append(4); }else { if(k % 2 == 0) { int t = k / 2; A.append(t); B.append(t); }else { int t = k / 2; A.append(t + 1); if(!(B.length() == 0 && t == 0)) { B.append(t); } } } } if(B.length() == 0) { B.append(0); } System.out.println(A.toString() + " " + B.toString()); } }