Takahashi has two positive integers A and B.

It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10).

Constraints

* 2 ≤ N ≤ 10^5
* N is an integer.

Input

Input is given from Standard Input in the following format:


N


Output

Print the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B".

Examples

Input

15


Output

6


Input

100000


Output

10
N= int(raw_input())

# print list(str(N))

sum_all = N
sum_tmp = N
tmp_A = 1
tmp_B = N
list_A_i = []
#for A in range(N):
for A in range(1, N/2):
    B = N - A
    list_A = list(str(A))
    list_B = list(str(B))
#    print list_A, list_B
    sum_tmp = sum(map(int, list_A))+ sum(map(int, list_B))
    if sum_tmp < sum_all:
        tmp_A = A
        tmp_B = B
        sum_all = sum_tmp

#print tmp_A, tmp_B
print sum_all
