n=int(input()) for i in range(1,n): ans=str(n-i) if "7" not in str(i) and "7" not in ans: print(i,int(ans)) break