N = int(input()) a, b = N, 0 for i, c in enumerate(str(N)[::-1]): if c == "7": a -= 10**i b += 10**i print(a, b)