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.util.*;
	import java.io.*;
	import java.text.*;
	import java.math.*;
	
	public class Codeforces{
		boolean multipleTC=false;
		int INF=(int)1e9+7;
		ArrayList<Integer>al = new ArrayList<>();
		
		void solve( int tc )throws Exception{
			long n = nl();
			if( n==1 ){ pn(1); return; }
			int lg = Long.toString(n).charAt(0)-'0', len = Long.toString(n).length();
			long d1 = lg;
			for( int i=0; i<len-1; i++ ) d1*=10; d1--;
			long d2 = n-d1;
			//long d1 = Math.floorDiv( n, 2), d2 = n-d1;
			
			
			pn( fs(d1)+fs(d2) );
		}
		
		long fs( long val ){
			long sum = (long)val%10;
			while( val>0 ){
				val/=10;
				sum+=val%10;
			}
			return sum;
		}
		
		class done implements Comparable<done>{
			long v1, v2, v3;
			public done( long v1, long v2, long v3 ){
				this.v1 = v1;
				this.v2 = v2;
				this.v3 = v3;
			}
			
			public int compareTo( done o ){
				return Long.compare( o.v1, this.v1 );
			}
		}
		
		void run() throws Exception{
			in = new FastReader();
			out = new PrintWriter( System.out );
			for( int i=1, t=(multipleTC)?ni():1 ; i<=t; i++ )solve(i);
			out.flush();
			out.close();
		}
		
		
		public static void main( String[]args )throws Exception{
			new Codeforces().run();
		}
		
		FastReader in;
		PrintWriter out;
		
		long[]la( int n )throws Exception{ long[]a=new long[n]; for( int i=0; i<n; i++ )a[i]=nl(); return a; }
		int[]ia( int n )throws Exception{ int[]a=new int[n]; for( int i=0; i<n; i++ )a[i]=ni(); return a; }
		int gcd( int a, int b ){ return (b==0)?a:gcd(b,a%b); }
		void p(Object o){ out.print(o); }
		void pn(Object o){ out.println(o); }
		void pni(Object o){ out.println(o); out.flush(); }
		String n(){ return in.next(); }
		int ni() throws Exception{ return Integer.parseInt(in.next()); }
		long nl() throws Exception{ return Long.parseLong(in.next()); }
		
		class FastReader{
			BufferedReader br;
			StringTokenizer st;
			public FastReader(){
				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();
			}
			String nextLine(){
				String str = "";
				try{
					str = br.readLine();
				}catch( IOException e ){
					e.printStackTrace();
				}return str;
			}
		}
	}