n = int(input()) digit = 0 a, b = 0, 0 while n != 0: n, r = divmod(n, 10) a += (r + 1) // 2 * 10**digit b += r // 2 * 10**digit digit += 1 print(a, b)