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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


import java.util.*;

public class A_GENERAL {

	public static void main(String[] args) {
		
		MyScanner sc = new MyScanner();
		long n = sc.nextLong();
		long a = n/2;
		long b = n - (n/2);
		int max = 0;
		long finala = 0, finalb = 0;
		int len = 0;
		long tmp2 = n;
		long first = 0;
		while(tmp2 != 0) {
			len++;
			if(tmp2/10 == 0) first = tmp2;
			tmp2 = tmp2/10;
		}
		long num = 0;
		long l = len;
		if(first == 1) {
			l--;
			first = 10;
		}
		long j = 0;
//		System.out.println("l = " + l);
		while(j < l-1) {
//			System.out.println(num + ", " + j);
			num = (num*10) + 9;
			j++;
		}
		
		for(int i = 1; i < first; i++) {
			long val = (long) ((long) i * Math.pow(10, l-1)) + num;
//			System.out.println(val + ", " + num);
			int tmp = Math.max(max, sumOfDigits(val) + sumOfDigits(n-val));
			if(max < tmp) {
				max = tmp;
				finala = val;
				finalb = n-val;
			}
		}
//		for(int i = 0; i <= 1000000; i++) {
//			max = Math.max(max, sumOfDigits(a-i) + sumOfDigits(b+i));
//			int tmp = Math.max(max, sumOfDigits(a-i) + sumOfDigits(b+i));
//			if(max < tmp) {
//				max = tmp;
//				finala = a-i;
//				finalb = b+i;
//			}
//		}
		System.out.println(max);
//		System.out.println(finala + ", " + finalb);
//		if(n % 2 != 0) {
//			System.out.println(sumOfDigits(n/2) + sumOfDigits(n - (n/2)));
//		} else {
//			System.out.println(Math.max(2 * sumOfDigits(n/2), sumOfDigits(n/2 + 1) + sumOfDigits(n/2 - 1)));
//		}
	}
	public static long maxValue(long n) {
		long out = 0;
		int i = 0;
		while(n != 0) {
			out = (long) (out * (Math.pow(10, i++) + 9));
			n = n/10;
		}
		return out/10;
	}
	public static int sumOfDigits(long n) {
		int sum = 0;
		while(n != 0) {
			sum += (int) (n % 10);
			n = n/10;
		}
		return sum;
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {while (st == null || !st.hasMoreElements()) {
			try {st = new StringTokenizer(br.readLine());}
			catch (IOException e) {e.printStackTrace();}}
		return st.nextToken();}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() {return Double.parseDouble(next());}
		String nextLine(){String str = "";
		try {str = br.readLine();}
		catch (IOException e) {e.printStackTrace();}
		return str;}
	}
	
}