import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); int length = arr.length; char[] next = new char[length]; Arrays.fill(next, '0'); for (int i = 0; i < length; i++) { if (arr[i] == '7') { arr[i] = '6'; next[i] = '1'; } } int b = Integer.parseInt(new String(next)); System.out.println(new String(arr) + " " + b); } }