import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.set_int_max_str_digits(10**6) MOD1 = 10 ** 9 MOD2 = 10 ** 9 + 7 MOD = MOD1 * MOD2 N = [int(x) - ord('0') for x in read().rstrip()] L = len(N) n = (L+1)//2 x = N[:n] if L & 1: X = x + x[:-1][::-1] else: X = x + x[::-1] answer = int(''.join(map(str, x))) % MOD if X > N: answer -= 1 answer -= pow(10, n - 1, MOD) - 1 for keta in range(1, L): d = (keta + 1) // 2 answer += 9 * pow(10, d - 1, MOD) print(answer % MOD1) print(answer % MOD2)