import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); int a = 0; int b = 0; for (char c : arr) { a *= 10; b *= 10; if (c == '7') { a += 1; b += 6; } else { a += c - '0'; } } System.out.println(a + " " + b); } }