import java.math.BigDecimal; import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; import java.util.TreeSet; public class Main { public static long MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] chs = sc.next().toCharArray(); char[] fst = new char[chs.length]; char[] snd = new char[chs.length]; for(int i = 0; i < chs.length; i++){ if(chs[i] != '7'){ fst[i] = chs[i]; snd[i] = '0'; }else{ fst[i] = (char)(chs[i] - 1); snd[i] = '1'; } } final int fst_num = Integer.parseInt(new StringBuilder().append(fst).toString()); final int snd_num = Integer.parseInt(new StringBuilder().append(snd).toString()); System.out.println(fst_num + " " + snd_num); } }