N = input() S = "" T = "" for n in N: if n == "7": S += "1" T += "6" else: S += "0" T += "7" print(int(S), int(T))