s = raw_input() a = [] x = '' for i in range(0, len(s)): if s[i] == '7': a[i] = '1' else: a[i] = '0' for i in range(0, len(s)): x = x + a[i] print str(int(s)-int(x)) + ' ' + str(int(x))