Problem: You are given a positive integer n.

Let S(x) be sum of digits in base 10 representation of x, for example, S(123) = 1 + 2 + 3 = 6, S(0) = 0.

Your task is to find two integers a, b, such that 0 ≤ a, b ≤ n, a + b = n and S(a) + S(b) is the largest possible among all such pairs.

Input

The only line of input contains an integer n (1 ≤ n ≤ 10^{12}).

Output

Print largest S(a) + S(b) among all pairs of integers a, b, such that 0 ≤ a, b ≤ n and a + b = n.

Examples

Input

35


Output

17


Input

10000000000


Output

91

Note

In the first example, you can choose, for example, a = 17 and b = 18, so that S(17) + S(18) = 1 + 7 + 1 + 8 = 17. It can be shown that it is impossible to get a larger answer.

In the second test example, you can choose, for example, a = 5000000001 and b = 4999999999, with S(5000000001) + S(4999999999) = 91. It can be shown that it is impossible to get a larger answer.

Solution (in PYTHON3):

Solution:
def sum_of_digits(x):
    """x is integer"""
    sod = 0
    while x > 0:
        sod += x % 10
        x = int(x / 10)
    return sod


def count9(x):
    """x is integer"""
    return list(str(x)).count("9")


def count_total_digit_number(x):
    """x is integer or string"""
    x = int(x)
    return len(str(x))


def solution1():

    n = int(input())

    ctdn = count_total_digit_number(n)
    c9 = count9(n)

    if c9 < ctdn - 1 or (c9 == ctdn - 1 and str(n)[0] == "9"):

        number = n

        while count9(number) != ctdn - 1 or (c9 == ctdn - 1 and str(number)[0] == "9"):
            number -= 1

        print(sum_of_digits(number) + sum_of_digits(n - number))

    else:
        print(sum_of_digits(n))


def solution2():
    n = int(input())

    ctdn = count_total_digit_number(n)

    if ctdn == count9(n):
        print(sum_of_digits(n))
        exit()

    if ctdn == 1:
        print(n)
        exit()

    s = 0

    lst = list(str(n))

    for i in range(ctdn):

        if len(lst) == 1:
            if lst[0] == "9":
                break
            else:
                s += int(lst[0])
                break

        if len(lst) == lst.count("9"):
            s += 9

        else:
            s += 10 + int(lst[0]) - 1

        del lst[0]

    print(s)


#solution1()
solution2()