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
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Integer num = Integer.valueOf(new Scanner(System.in).nextLine());
		int min = Integer.MAX_VALUE;
		for (Integer a = num - 1, b = 1; a > 0 && b < num; a--, b = num - a) {
			int sum = 0;
			for (Integer ta = a, tb = b; ta > 0 || tb > 0; ta /= 10, tb /= 10) {
				sum += ta % 10;
				sum += tb % 10;
			}
			min = Integer.min(min, sum);
		}
		System.out.println(min);
	}
}