Nstr = input().rstrip()

Nlst = [int(c) for c in Nstr]

def solve(Nlst):
    print(solve_core(Nlst, 10**9))
    print(solve_core(Nlst, 10**9 + 7))

def solve_core(Nlst, mod):
    n = len(Nlst)
    res = count_easy(n - 1, mod)
    head = Nlst[:(n + 1)//2]
    tail = Nlst[-n//2:]
    res += count_head(head, mod)
    head.reverse()
    for h, t, in zip(head, tail):
        if h < t:
            break
        if h > t:
            res -= 1
            break
    return res % mod


def count_easy(n, mod):
    m = (n + 1)//2
    ans = (2 * (pow(10, m, mod) - 1)) % mod
    if n & 1:
        ans -= 9 * pow(10, m - 1, mod)
        ans %= mod
    return ans

def count_head(head, mod):
    ans = 0
    head[0] -= 1
    for h in head:
        ans = (ans * 10 + h) % mod
    head[0] += 1
    return (ans + 1) % mod

solve(Nlst)