import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String N = sc.next(); String a = ""; String b = ""; for(int i = 0; i < N.length(); i++) { String s = String.valueOf(N.charAt(i)); if(s.equals("7")) { a += "3"; b += "4"; } else { a += s; b += "0"; } } int A = Integer.parseInt(a); int B = Integer.parseInt(b); System.out.println(A + " " + B); } }