n = int(input()) tmp = n a = 0 t = 1 for i in range(10): if n % 10 == 7: a += t t *= 10 n //= 10 print(a, tmp - a)