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.InputStream;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.BufferedWriter;
import java.io.IOException;
import java.lang.Math; 

/*
34535634
 */

public class Main
{
	static long n, a, b;
	static long presm[] = new long[1000009];

	public static void main(String[] args)throws IOException
	{
		MainFastScan scanner = new MainFastScan();
		MainFastPrint printer = new MainFastPrint();

		n = scanner.nextLong();
		long res = 0; 
		long mx = 0;
		
		a = 0;
		
		while(a<n)
		{
			a = 10*a + 9;
		}
		
		if(a>n) a/=10;
		
		b = n-a;
		
		//System.out.println(a + " " + b);
		
		
		
		
//		for(int i=0; i<=n; i++)
//		{
//			res = dsum(i)+dsum(n-i);
//			mx = Math.max(mx, res);
//			System.out.println(i + " " + (n-i) + " =  " + res);
//		}
//
//		if(n<9)
//		{
//			res = n;
//		}
//		else 
//		{
//			a = n/2;
//
//			a += 9-(a%10);
//
//			b = n - a;
//			System.out.println(a + " " + b);
//			res = dsum(a)+dsum(b);
//		}

		printer.printLine(Long.toString(dsum(a)+dsum(b)));
		printer.close();	
	}

	static long dsum(long n)
	{
		long sum = 0;
		while(n>0)
		{
			sum += (n%10);
			n /= 10;
		}
		return sum;
	}
}










class MainFastPrint
{
	private final BufferedWriter bw;
	public MainFastPrint(){bw=new BufferedWriter(new OutputStreamWriter(System.out));}
	public void print(String str)throws IOException{bw.append(str);}
	public void printLine(String str)throws IOException{print(str); bw.append("\n");}
	public void close()throws IOException{bw.close();}
}

class MainFastScan
{
	private byte[] buf=new byte[1024];
	private int index;
	private InputStream in;
	private int total;
	public MainFastScan()
	{
		in=System.in;
	}
	public int scan()throws IOException
	{
		if(total<0)
			throw new InputMismatchException();
		if(index>=total)
		{
			index=0;
			total=in.read(buf);
			if(total<=0)
				return -1;
		}
		return buf[index++];
	}
	public int nextInt()throws IOException
	{
		int integer=0;
		int n=scan();
		while(isWhiteSpace(n)) n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n))
		{
			if(n>='0'&&n<='9')
			{
				integer*=10;
				integer+=n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		return neg*integer;
	}

	public long nextLong()throws IOException
	{
		long res=0;
		int n = scan();
		while(isWhiteSpace(n)) n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n))
		{
			if(n>='0'&&n<='9')
			{
				res *= 10;
				res += n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		return neg*res;
	}

	public double nextDouble()throws IOException
	{
		double doub=0;
		int n=scan();
		while(isWhiteSpace(n)) n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n)&&n!='.')
		{
			if(n>='0'&&n<='9')
			{
				doub*=10;
				doub+=n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		if(n=='.')
		{
			n=scan();
			double temp=1;
			while(!isWhiteSpace(n))
			{
				if(n>='0'&&n<='9')
				{
					temp/=10;
					doub+=(n-'0')*temp;
					n=scan();
				}
				else throw new InputMismatchException();
			}
		}
		return doub*neg;
	}
	public String nextLine()throws IOException
	{
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//br.readLine();
		StringBuilder sb=new StringBuilder();
		int n=scan();
		while(isWhiteSpace(n)) n=scan();
		while(!isWhiteSpace(n))
		{
			sb.append((char)n);
			n=scan();
		}
		return sb.toString();
	}
	private boolean isWhiteSpace(int n)
	{
		if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
}