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
def findDigits(num):
	l = []
	while(num > 0):
		l.append(num % 10)
		num = num / 10
	return l	


n = input()
i = 1
sum1 = 1000000000
while(i <= n/2):
	l1 = findDigits(i)
	l2 = findDigits(n - i)
	s1 = sum(l1)
	s2 = sum(l2)
	if(s1 + s2 < sum1):
		sum1 = s1 + s2
	i = i + 1
print(sum1)		