n = raw_input() a = '' b = '' f = False for c in n: if c == '7': a += '6' b += '1' f = True else: a += c if f: b += '0' print a,b