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