N=input() P=int(''.join(['01'[x=='7']for x in list(N)])) print(int(N)-P,P)