n = input() a = "" b = "" for i in range(len(n)): if n[i] == "7": a += "1" b += "6" else: a += "0" b += n[i] print(int(a), int(b))