n = list(input()) l = [] for i in range(len(n)): if n[i] == '7': l.append(i) for i in l: n[i] = '6' a = ''.join(n) l2 = [] for i in l: l2.append(int('1' + '0' * (len(n)-i-1))) b = sum(l2) print(a, b)