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

public class Main {
    static BufferedReader br;
    static StringTokenizer st;

    static String nextToken() {
        try {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return st.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt(nextToken());
    }

    static char nextChar() throws IOException {
        return (char) br.read();
    }

    private static long nextLong() {
        return Long.parseLong(nextToken());
    }

    private static String nextString() throws IOException {
        return br.readLine();
    }

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));//new FileInputStream("input.txt")));
        long n = nextLong();
        long ans = 0;
        long schet = 9;
        while (n - schet > 0) {
            ans += 9;
            n -= schet;
            schet *= 10;
        }
        while (n > 0) {
            ans += (n % 10);
            n /= 10;
        }
        System.out.println(ans);

    }

        /*Pair[] tochki = new Pair[n * 2];
        int min = 1000000;
        for (int i = 0; i < n; i++) {
            a[i] = new Pair(nextInt(), nextInt());
            if (a[i].x2 - a[i].x1 < min) min = a[i].x2 - a[i].x1;
        }
        for (int i = 0; i < 2 * n; i += 2) {
            tochki[i] = new Pair(a[i / 2].x1, 1);
            tochki[i + 1] = new Pair(a[i / 2].x2, -1);
        }
        Arrays.sort(a);
        for (int i = 1; i < min; i++) {
            if (!prow(a, i, tochki)) {
                System.out.println(i - 1);
                System.exit(0);
            }
        }

                PrintWriter pw = new PrintWriter("output.txt");
        int n = nextInt();
        int m = nextInt();
        int q = nextInt();
        TreeMap<Integer, Integer> dobr = new TreeMap();
        TreeMap<Integer, Integer> zlie = new TreeMap();
        Pair[] save = new Pair[m];
        for (int i = 0; i < m; i++) {
            save[i] = new Pair(nextInt() - 1, nextInt() - 1);
        }
        int start = 0;
        Pair[] prefsum = new Pair[m];
        int c;
        for (int i = 0; i < m; i++) {
            boolean tr = false;
            while ((zlie.containsKey(save[i].x2) && zlie.containsKey(save[i].x1))
                    || (dobr.containsKey(save[i].x2) && dobr.containsKey(save[i].x1))) {
                if (zlie.get(save[start].x1) > 1) {
                    zlie.put(save[start].x1, zlie.get(save[start].x1) - 1);
                } else {
                    zlie.remove(save[start].x1);
                }
                if (dobr.get(save[start].x2) > 1) {
                    dobr.put(save[start].x2, dobr.get(save[start].x2) - 1);
                } else {
                    dobr.remove(save[start].x2);
                }
                start++;
                tr = true;
            }
            if (!tr && (zlie.containsKey(save[i].x2) || dobr.containsKey(save[i].x1))) {
                c = save[i].x2;
                save[i].x2 = save[i].x1;
                save[i].x1 = c;
            }
            if (dobr.containsKey(save[i].x2)) {
                dobr.put(save[i].x2, dobr.get(save[i].x2) + 1);
            } else
                dobr.put(save[i].x2, 1);
            if (zlie.containsKey(save[i].x1)) {
                zlie.put(save[i].x1, zlie.get(save[i].x1) + 1);
            } else
                zlie.put(save[i].x1, 1);
            prefsum[i] = new Pair(start, i);
        }
        Pair[] zap = new Pair[q];
        for (int i = 0; i < q; i++) {
            zap[i] = new Pair(nextInt() - 1, nextInt() - 1);
        }
        for (int i = 0; i < q; i++) {
            if (prefsum[zap[i].x2].x1 <= zap[i].x1) {
                System.out.println("Possible");
            } else {
                System.out.println("Impossible");
            }
        }

        int x1, x2;
        for (int i = 0; i < q; i++) {
            x1 = nextInt() - 1;
            x2 = nextInt() - 1;
            if (prefsum[x2].x1 <= x1) {
                System.out.println("Possible");
            } else {
                System.out.println("Impossible");
            }
        }

    }

    private static boolean prow(Pair[] a, int min, Pair[] tochki) {
        int vosh = 0;
        int dolgi[] = new int[a.length];
        for (int i = 1; i < tochki.length; i++) {
            vosh += (tochki[i].x1 - tochki[i - 1].x1);
            if (tochki[i].x2 ==)
        }
        return true;
    }*/
}


class Pair implements Comparable<Pair> {
    long x1, x2;

    public Pair(long x1, long x2) {
        this.x1 = x1;
        this.x2 = x2;
    }

    @Override
    public int compareTo(Pair o) {
        return Long.compare(o.x1 * o.x2, x1 * x2);
    }
}