import java.util.Scanner; public class Main { Scanner in = new Scanner(System.in); public void solve() { String n = in.next(); char[] cs = n.toCharArray(); int b = 0; for(int i = 0; i < cs.length; i++){ if(cs[cs.length - i - 1] == '7'){ b += (int)Math.pow(10, i); cs[cs.length - i - 1] = '6'; } } System.out.println(new String(cs) + " " + b); } public static void main(String[] args) { new Main().solve(); } }