def main(): N = input() if int(N) < 7: print(-1) return n = '' for s in N: if s == '7': n += '1' else: n += '0' a = int(n) b = int(N) - a print(a, b) main()