N = int(input()) A = 0 B = 0 tmp = 1 while N > 0: if N % 10 != 7: A += (N % 10) * tmp else: A += 6 * tmp B += 1 * tmp N //= 10 tmp *= 10 print(A,B)